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

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 (451) hide show
  1. package/lib/cjs/Constant.js.map +1 -1
  2. package/lib/cjs/Geometry.js.map +1 -1
  3. package/lib/cjs/bspline/AkimaCurve3d.js.map +1 -1
  4. package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
  5. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  6. package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
  7. package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
  8. package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
  9. package/lib/cjs/bspline/Bezier1dNd.js.map +1 -1
  10. package/lib/cjs/bspline/BezierCurve3d.js.map +1 -1
  11. package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
  12. package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
  13. package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
  14. package/lib/cjs/bspline/KnotVector.js.map +1 -1
  15. package/lib/cjs/bspline/SurfaceLocationDetail.js.map +1 -1
  16. package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
  17. package/lib/cjs/clipping/BooleanClipFactory.js.map +1 -1
  18. package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
  19. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  20. package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
  21. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  22. package/lib/cjs/clipping/ClipVector.js.map +1 -1
  23. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  24. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  25. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  26. package/lib/cjs/core-geometry.js.map +1 -1
  27. package/lib/cjs/curve/Arc3d.js.map +1 -1
  28. package/lib/cjs/curve/ConstructCurveBetweenCurves.js.map +1 -1
  29. package/lib/cjs/curve/CoordinateXYZ.js.map +1 -1
  30. package/lib/cjs/curve/CurveChain.js.map +1 -1
  31. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  32. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  33. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  34. package/lib/cjs/curve/CurveCurveCloseApproachXY.js.map +1 -1
  35. package/lib/cjs/curve/CurveCurveIntersectXY.js.map +1 -1
  36. package/lib/cjs/curve/CurveCurveIntersectXYZ.js.map +1 -1
  37. package/lib/cjs/curve/CurveExtendMode.js.map +1 -1
  38. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  39. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  40. package/lib/cjs/curve/CurveOps.js.map +1 -1
  41. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  42. package/lib/cjs/curve/CurveProcessor.js.map +1 -1
  43. package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
  44. package/lib/cjs/curve/GeometryQuery.js.map +1 -1
  45. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  46. package/lib/cjs/curve/LineString3d.js.map +1 -1
  47. package/lib/cjs/curve/Loop.d.ts +1 -2
  48. package/lib/cjs/curve/Loop.d.ts.map +1 -1
  49. package/lib/cjs/curve/Loop.js.map +1 -1
  50. package/lib/cjs/curve/OffsetOptions.js.map +1 -1
  51. package/lib/cjs/curve/ParityRegion.js.map +1 -1
  52. package/lib/cjs/curve/Path.d.ts +1 -2
  53. package/lib/cjs/curve/Path.d.ts.map +1 -1
  54. package/lib/cjs/curve/Path.js.map +1 -1
  55. package/lib/cjs/curve/PointString3d.js.map +1 -1
  56. package/lib/cjs/curve/ProxyCurve.js.map +1 -1
  57. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  58. package/lib/cjs/curve/Query/CurveSplitContext.js.map +1 -1
  59. package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
  60. package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
  61. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  62. package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
  63. package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
  64. package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
  65. package/lib/cjs/curve/RegionOps.js.map +1 -1
  66. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  67. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  68. package/lib/cjs/curve/UnionRegion.js.map +1 -1
  69. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
  70. package/lib/cjs/curve/internalContexts/ChainCollectorContext.js.map +1 -1
  71. package/lib/cjs/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  72. package/lib/cjs/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
  73. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  74. package/lib/cjs/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
  75. package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -1
  76. package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
  77. package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
  78. package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
  79. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
  80. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  81. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  82. package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
  83. package/lib/cjs/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
  84. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  85. package/lib/cjs/curve/spiral/ClothoidSeries.js.map +1 -1
  86. package/lib/cjs/curve/spiral/CubicEvaluator.js.map +1 -1
  87. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  88. package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  89. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  90. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  91. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  92. package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
  93. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  94. package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  95. package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
  96. package/lib/cjs/curve/spiral/XYCurveEvaluator.js.map +1 -1
  97. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  98. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  99. package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
  100. package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
  101. package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
  102. package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
  103. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  104. package/lib/cjs/geometry3d/FrustumAnimation.js.map +1 -1
  105. package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
  106. package/lib/cjs/geometry3d/GrowableBlockedArray.js.map +1 -1
  107. package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
  108. package/lib/cjs/geometry3d/GrowableXYArray.d.ts +26 -6
  109. package/lib/cjs/geometry3d/GrowableXYArray.d.ts.map +1 -1
  110. package/lib/cjs/geometry3d/GrowableXYArray.js +66 -15
  111. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  112. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +5 -2
  113. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  114. package/lib/cjs/geometry3d/GrowableXYZArray.js +10 -3
  115. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  116. package/lib/cjs/geometry3d/IndexedCollectionInterval.js.map +1 -1
  117. package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
  118. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  119. package/lib/cjs/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
  120. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  121. package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
  122. package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
  123. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  124. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  125. package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
  126. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  127. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  128. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  129. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  130. package/lib/cjs/geometry3d/PointStreaming.js.map +1 -1
  131. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  132. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  133. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  134. package/lib/cjs/geometry3d/Range.js.map +1 -1
  135. package/lib/cjs/geometry3d/Ray2d.js.map +1 -1
  136. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  137. package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
  138. package/lib/cjs/geometry3d/Segment1d.js.map +1 -1
  139. package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
  140. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  141. package/lib/cjs/geometry3d/UVSurfaceOps.js.map +1 -1
  142. package/lib/cjs/geometry3d/XYZProps.js.map +1 -1
  143. package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
  144. package/lib/cjs/geometry4d/Map4d.js.map +1 -1
  145. package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
  146. package/lib/cjs/geometry4d/MomentData.js.map +1 -1
  147. package/lib/cjs/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
  148. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  149. package/lib/cjs/numerics/BandedSystem.js.map +1 -1
  150. package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
  151. package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
  152. package/lib/cjs/numerics/Complex.js.map +1 -1
  153. package/lib/cjs/numerics/ConvexPolygon2d.js.map +1 -1
  154. package/lib/cjs/numerics/Newton.js.map +1 -1
  155. package/lib/cjs/numerics/PascalCoefficients.js.map +1 -1
  156. package/lib/cjs/numerics/PolarData.js.map +1 -1
  157. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  158. package/lib/cjs/numerics/Quadrature.js.map +1 -1
  159. package/lib/cjs/numerics/Range1dArray.js.map +1 -1
  160. package/lib/cjs/numerics/TriDiagonalSystem.js.map +1 -1
  161. package/lib/cjs/numerics/UnionFind.js.map +1 -1
  162. package/lib/cjs/numerics/UsageSums.js.map +1 -1
  163. package/lib/cjs/polyface/AuxData.js.map +1 -1
  164. package/lib/cjs/polyface/BoxTopology.js.map +1 -1
  165. package/lib/cjs/polyface/FacetFaceData.js.map +1 -1
  166. package/lib/cjs/polyface/FacetLocationDetail.js.map +1 -1
  167. package/lib/cjs/polyface/FacetOrientation.js.map +1 -1
  168. package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  169. package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
  170. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  171. package/lib/cjs/polyface/Polyface.js.map +1 -1
  172. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +9 -5
  173. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  174. package/lib/cjs/polyface/PolyfaceBuilder.js +9 -5
  175. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  176. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  177. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  178. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  179. package/lib/cjs/polyface/RangeLengthData.js.map +1 -1
  180. package/lib/cjs/polyface/TaggedNumericData.js.map +1 -1
  181. package/lib/cjs/polyface/TriangleCandidate.js.map +1 -1
  182. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  183. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  184. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  185. package/lib/cjs/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
  186. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  187. package/lib/cjs/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
  188. package/lib/cjs/polyface/multiclip/RangeSearch.js.map +1 -1
  189. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  190. package/lib/cjs/polyface/multiclip/XYPointBuckets.js.map +1 -1
  191. package/lib/cjs/serialization/BGFBAccessors.js.map +1 -1
  192. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  193. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  194. package/lib/cjs/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
  195. package/lib/cjs/serialization/DeepCompare.js.map +1 -1
  196. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  197. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  198. package/lib/cjs/solid/Box.js.map +1 -1
  199. package/lib/cjs/solid/Cone.js.map +1 -1
  200. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  201. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  202. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  203. package/lib/cjs/solid/SolidPrimitive.js.map +1 -1
  204. package/lib/cjs/solid/Sphere.js.map +1 -1
  205. package/lib/cjs/solid/SweepContour.js.map +1 -1
  206. package/lib/cjs/solid/TorusPipe.js.map +1 -1
  207. package/lib/cjs/topology/ChainMerge.js.map +1 -1
  208. package/lib/cjs/topology/Graph.js.map +1 -1
  209. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  210. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  211. package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  212. package/lib/cjs/topology/HalfEdgeGraphValidation.js.map +1 -1
  213. package/lib/cjs/topology/HalfEdgeMarkSet.js.map +1 -1
  214. package/lib/cjs/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  215. package/lib/cjs/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  216. package/lib/cjs/topology/HalfEdgePositionDetail.js.map +1 -1
  217. package/lib/cjs/topology/HalfEdgePriorityQueue.js.map +1 -1
  218. package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
  219. package/lib/cjs/topology/MaskManager.js.map +1 -1
  220. package/lib/cjs/topology/Merging.js.map +1 -1
  221. package/lib/cjs/topology/RegularizeFace.js.map +1 -1
  222. package/lib/cjs/topology/SignedDataSummary.js.map +1 -1
  223. package/lib/cjs/topology/SpaceTriangulation.js.map +1 -1
  224. package/lib/cjs/topology/Triangulation.js.map +1 -1
  225. package/lib/cjs/topology/XYParitySearchContext.js.map +1 -1
  226. package/lib/esm/Constant.js.map +1 -1
  227. package/lib/esm/Geometry.js.map +1 -1
  228. package/lib/esm/bspline/AkimaCurve3d.js.map +1 -1
  229. package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
  230. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  231. package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
  232. package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
  233. package/lib/esm/bspline/BSplineSurface.js.map +1 -1
  234. package/lib/esm/bspline/Bezier1dNd.js.map +1 -1
  235. package/lib/esm/bspline/BezierCurve3d.js.map +1 -1
  236. package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
  237. package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
  238. package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
  239. package/lib/esm/bspline/KnotVector.js.map +1 -1
  240. package/lib/esm/bspline/SurfaceLocationDetail.js.map +1 -1
  241. package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
  242. package/lib/esm/clipping/BooleanClipFactory.js.map +1 -1
  243. package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
  244. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  245. package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
  246. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  247. package/lib/esm/clipping/ClipVector.js.map +1 -1
  248. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  249. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  250. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  251. package/lib/esm/core-geometry.js.map +1 -1
  252. package/lib/esm/curve/Arc3d.js.map +1 -1
  253. package/lib/esm/curve/ConstructCurveBetweenCurves.js.map +1 -1
  254. package/lib/esm/curve/CoordinateXYZ.js.map +1 -1
  255. package/lib/esm/curve/CurveChain.js.map +1 -1
  256. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  257. package/lib/esm/curve/CurveCollection.js.map +1 -1
  258. package/lib/esm/curve/CurveCurve.js.map +1 -1
  259. package/lib/esm/curve/CurveCurveCloseApproachXY.js.map +1 -1
  260. package/lib/esm/curve/CurveCurveIntersectXY.js.map +1 -1
  261. package/lib/esm/curve/CurveCurveIntersectXYZ.js.map +1 -1
  262. package/lib/esm/curve/CurveExtendMode.js.map +1 -1
  263. package/lib/esm/curve/CurveFactory.js.map +1 -1
  264. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  265. package/lib/esm/curve/CurveOps.js.map +1 -1
  266. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  267. package/lib/esm/curve/CurveProcessor.js.map +1 -1
  268. package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
  269. package/lib/esm/curve/GeometryQuery.js.map +1 -1
  270. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  271. package/lib/esm/curve/LineString3d.js.map +1 -1
  272. package/lib/esm/curve/Loop.d.ts +1 -2
  273. package/lib/esm/curve/Loop.d.ts.map +1 -1
  274. package/lib/esm/curve/Loop.js.map +1 -1
  275. package/lib/esm/curve/OffsetOptions.js.map +1 -1
  276. package/lib/esm/curve/ParityRegion.js.map +1 -1
  277. package/lib/esm/curve/Path.d.ts +1 -2
  278. package/lib/esm/curve/Path.d.ts.map +1 -1
  279. package/lib/esm/curve/Path.js.map +1 -1
  280. package/lib/esm/curve/PointString3d.js.map +1 -1
  281. package/lib/esm/curve/ProxyCurve.js.map +1 -1
  282. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  283. package/lib/esm/curve/Query/CurveSplitContext.js.map +1 -1
  284. package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
  285. package/lib/esm/curve/Query/InOutTests.js.map +1 -1
  286. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  287. package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
  288. package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
  289. package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
  290. package/lib/esm/curve/RegionOps.js.map +1 -1
  291. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  292. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  293. package/lib/esm/curve/UnionRegion.js.map +1 -1
  294. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
  295. package/lib/esm/curve/internalContexts/ChainCollectorContext.js.map +1 -1
  296. package/lib/esm/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  297. package/lib/esm/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
  298. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  299. package/lib/esm/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
  300. package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -1
  301. package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
  302. package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
  303. package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
  304. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
  305. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  306. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  307. package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
  308. package/lib/esm/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
  309. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  310. package/lib/esm/curve/spiral/ClothoidSeries.js.map +1 -1
  311. package/lib/esm/curve/spiral/CubicEvaluator.js.map +1 -1
  312. package/lib/esm/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  313. package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  314. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  315. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  316. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  317. package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
  318. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  319. package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  320. package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
  321. package/lib/esm/curve/spiral/XYCurveEvaluator.js.map +1 -1
  322. package/lib/esm/geometry3d/Angle.js.map +1 -1
  323. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  324. package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
  325. package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
  326. package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
  327. package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
  328. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  329. package/lib/esm/geometry3d/FrustumAnimation.js.map +1 -1
  330. package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
  331. package/lib/esm/geometry3d/GrowableBlockedArray.js.map +1 -1
  332. package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
  333. package/lib/esm/geometry3d/GrowableXYArray.d.ts +26 -6
  334. package/lib/esm/geometry3d/GrowableXYArray.d.ts.map +1 -1
  335. package/lib/esm/geometry3d/GrowableXYArray.js +66 -15
  336. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  337. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +5 -2
  338. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  339. package/lib/esm/geometry3d/GrowableXYZArray.js +10 -3
  340. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  341. package/lib/esm/geometry3d/IndexedCollectionInterval.js.map +1 -1
  342. package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
  343. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  344. package/lib/esm/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
  345. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  346. package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
  347. package/lib/esm/geometry3d/Plane3d.js.map +1 -1
  348. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  349. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  350. package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
  351. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  352. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  353. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  354. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  355. package/lib/esm/geometry3d/PointStreaming.js.map +1 -1
  356. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  357. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  358. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  359. package/lib/esm/geometry3d/Range.js.map +1 -1
  360. package/lib/esm/geometry3d/Ray2d.js.map +1 -1
  361. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  362. package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
  363. package/lib/esm/geometry3d/Segment1d.js.map +1 -1
  364. package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
  365. package/lib/esm/geometry3d/Transform.js.map +1 -1
  366. package/lib/esm/geometry3d/UVSurfaceOps.js.map +1 -1
  367. package/lib/esm/geometry3d/XYZProps.js.map +1 -1
  368. package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
  369. package/lib/esm/geometry4d/Map4d.js.map +1 -1
  370. package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
  371. package/lib/esm/geometry4d/MomentData.js.map +1 -1
  372. package/lib/esm/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
  373. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  374. package/lib/esm/numerics/BandedSystem.js.map +1 -1
  375. package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
  376. package/lib/esm/numerics/ClusterableArray.js.map +1 -1
  377. package/lib/esm/numerics/Complex.js.map +1 -1
  378. package/lib/esm/numerics/ConvexPolygon2d.js.map +1 -1
  379. package/lib/esm/numerics/Newton.js.map +1 -1
  380. package/lib/esm/numerics/PascalCoefficients.js.map +1 -1
  381. package/lib/esm/numerics/PolarData.js.map +1 -1
  382. package/lib/esm/numerics/Polynomials.js.map +1 -1
  383. package/lib/esm/numerics/Quadrature.js.map +1 -1
  384. package/lib/esm/numerics/Range1dArray.js.map +1 -1
  385. package/lib/esm/numerics/TriDiagonalSystem.js.map +1 -1
  386. package/lib/esm/numerics/UnionFind.js.map +1 -1
  387. package/lib/esm/numerics/UsageSums.js.map +1 -1
  388. package/lib/esm/polyface/AuxData.js.map +1 -1
  389. package/lib/esm/polyface/BoxTopology.js.map +1 -1
  390. package/lib/esm/polyface/FacetFaceData.js.map +1 -1
  391. package/lib/esm/polyface/FacetLocationDetail.js.map +1 -1
  392. package/lib/esm/polyface/FacetOrientation.js.map +1 -1
  393. package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  394. package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
  395. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  396. package/lib/esm/polyface/Polyface.js.map +1 -1
  397. package/lib/esm/polyface/PolyfaceBuilder.d.ts +9 -5
  398. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  399. package/lib/esm/polyface/PolyfaceBuilder.js +9 -5
  400. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  401. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  402. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  403. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  404. package/lib/esm/polyface/RangeLengthData.js.map +1 -1
  405. package/lib/esm/polyface/TaggedNumericData.js.map +1 -1
  406. package/lib/esm/polyface/TriangleCandidate.js.map +1 -1
  407. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  408. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  409. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  410. package/lib/esm/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
  411. package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  412. package/lib/esm/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
  413. package/lib/esm/polyface/multiclip/RangeSearch.js.map +1 -1
  414. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  415. package/lib/esm/polyface/multiclip/XYPointBuckets.js.map +1 -1
  416. package/lib/esm/serialization/BGFBAccessors.js.map +1 -1
  417. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  418. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  419. package/lib/esm/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
  420. package/lib/esm/serialization/DeepCompare.js.map +1 -1
  421. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  422. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  423. package/lib/esm/solid/Box.js.map +1 -1
  424. package/lib/esm/solid/Cone.js.map +1 -1
  425. package/lib/esm/solid/LinearSweep.js.map +1 -1
  426. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  427. package/lib/esm/solid/RuledSweep.js.map +1 -1
  428. package/lib/esm/solid/SolidPrimitive.js.map +1 -1
  429. package/lib/esm/solid/Sphere.js.map +1 -1
  430. package/lib/esm/solid/SweepContour.js.map +1 -1
  431. package/lib/esm/solid/TorusPipe.js.map +1 -1
  432. package/lib/esm/topology/ChainMerge.js.map +1 -1
  433. package/lib/esm/topology/Graph.js.map +1 -1
  434. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  435. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  436. package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  437. package/lib/esm/topology/HalfEdgeGraphValidation.js.map +1 -1
  438. package/lib/esm/topology/HalfEdgeMarkSet.js.map +1 -1
  439. package/lib/esm/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  440. package/lib/esm/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  441. package/lib/esm/topology/HalfEdgePositionDetail.js.map +1 -1
  442. package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
  443. package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
  444. package/lib/esm/topology/MaskManager.js.map +1 -1
  445. package/lib/esm/topology/Merging.js.map +1 -1
  446. package/lib/esm/topology/RegularizeFace.js.map +1 -1
  447. package/lib/esm/topology/SignedDataSummary.js.map +1 -1
  448. package/lib/esm/topology/SpaceTriangulation.js.map +1 -1
  449. package/lib/esm/topology/Triangulation.js.map +1 -1
  450. package/lib/esm/topology/XYParitySearchContext.js.map +1 -1
  451. package/package.json +3 -3
@@ -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,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC;IACnE,CAAC;IACD,IAAW,UAAU,CAAC,KAAc;QAClC,IAAI,CAAC,WAA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AAe;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":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Curve\n */\n\nimport { Geometry } from \"../Geometry\";\nimport { Angle } from \"../geometry3d/Angle\";\n\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\n\n/**\n * Tolerance blob for various stroking methods.\n *\n * * Across many applications, the critical concepts are: chordTol, angleTol, maxEdgeLength\n * * Chord error is an distance measured from a curve or facet to its approximating stroke or facet.\n * * angle is the angle between two contiguous strokes or across a facet edge.\n * * maxEdgeLength is the length of a stroke or a edge of a facet.\n *\n * It is rare for all three to be active at once:\n * * Nearly all stroke and facet use cases will apply an angle tolerance.\n * * * For curves, 15 degrees is typical\n * * * For facets, 22.5 degrees is typical.\n * * * Halving the angle tolerance will (roughly) make curves get twice as many strokes, and surfaces get 4 times as many facets.\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.\n * * When creating output for devices such as 3D printing will want a chord tolerance.\n * * For graphics display, use an angle tolerance of around 15 degrees and an chord tolerance which is the size of several pixels.\n * * Analysis meshes (e.g. Finite Elements) commonly need to apply maxEdgeLength.\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.\n * * Facet tolerances are, as the Pirates' Code, guidelines, not absolute rules. Facet and stroke code may ignore tolerances in awkward situations.\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.\n * @public\n */\nexport class StrokeOptions {\n /** Distance from stroke to actual geometry */\n public chordTol?: number;\n /** Turning angle between strokes. */\n public angleTol?: Angle;\n /** Maximum length of a single stroke. */\n public maxEdgeLength?: number;\n /** Caller expects convex facets. */\n public needConvexFacets?: boolean;\n /** Minimum strokes on a primitive */\n public minStrokesPerPrimitive?: number;\n /** Whether or not to triangulate each added facet */\n public shouldTriangulate: boolean = false;\n private _needNormals?: boolean;\n private _needTwoSided?: boolean;\n private _needParams?: boolean;\n /** Whether params are requested. */\n public get needParams(): boolean {\n return this._needParams !== undefined ? this._needParams : false;\n }\n public set needParams(value: boolean) {\n this._needParams = value;\n }\n /** Whether normals are requested */\n public get needNormals(): boolean {\n return this._needNormals !== undefined ? this._needNormals : false;\n }\n public set needNormals(value: boolean) {\n this._needNormals = value;\n }\n /** Whether twoSided is requested. */\n public get needTwoSided(): boolean {\n return this._needTwoSided !== undefined ? this._needTwoSided : false;\n }\n public set needTwoSided(value: boolean) {\n this._needTwoSided = value;\n }\n /** Optional color request flag */\n public needColors?: boolean;\n /** Default number of strokes for a circle. */\n public defaultCircleStrokes = 16;\n /** Ask if angleTol is specified */\n public get hasAngleTol(): boolean {\n return this.angleTol !== undefined && Math.abs(this.angleTol.radians) > 0.0;\n }\n /** Ask if chordTol is specified */\n public get hasChordTol(): boolean {\n return this.chordTol !== undefined && this.chordTol > 0.0;\n }\n /** Ask if maxEdgeLength is specified */\n public get hasMaxEdgeLength(): boolean {\n return this.maxEdgeLength !== undefined && this.maxEdgeLength > 0.0;\n }\n /** Return a deep clone */\n public clone(): StrokeOptions {\n const options = new StrokeOptions();\n options.chordTol = this.chordTol;\n options.angleTol = this.angleTol?.clone();\n options.maxEdgeLength = this.maxEdgeLength;\n options.needConvexFacets = this.needConvexFacets;\n options.minStrokesPerPrimitive = this.minStrokesPerPrimitive;\n options.shouldTriangulate = this.shouldTriangulate;\n options._needNormals = this._needNormals;\n options._needTwoSided = this._needTwoSided;\n options._needParams = this._needParams;\n options.needColors = this.needColors;\n options.defaultCircleStrokes = this.defaultCircleStrokes;\n return options;\n }\n /** Return stroke count which is the larger of the minCount or count needed for edge length condition. */\n public applyMaxEdgeLength(minCount: number, totalLength: number): number {\n totalLength = Math.abs(totalLength);\n if (this.maxEdgeLength && this.maxEdgeLength > 0.0 && minCount * this.maxEdgeLength < totalLength) {\n minCount = Geometry.stepCount(this.maxEdgeLength, totalLength, minCount);\n }\n return minCount;\n }\n /**\n * Return stroke count which is the larger of the existing count or count needed for angle condition for given\n * sweepRadians.\n * * defaultStepRadians is assumed to be larger than zero.\n */\n public applyAngleTol(minCount: number, sweepRadians: number, defaultStepRadians: number): number {\n return StrokeOptions.applyAngleTol(this, minCount, sweepRadians, defaultStepRadians);\n }\n /**\n * Return stroke count which is the larger of minCount and the count required to turn sweepRadians, using tolerance\n * from the options.\n */\n public static applyAngleTol(\n options: StrokeOptions | undefined, minCount: number, sweepRadians: number, defaultStepRadians?: number,\n ): number {\n sweepRadians = Math.abs(sweepRadians);\n let stepRadians = defaultStepRadians ? defaultStepRadians : Math.PI / 8.0;\n if (options && options.angleTol && options.angleTol.radians > 0.0)\n stepRadians = options.angleTol.radians;\n if (minCount * stepRadians < sweepRadians)\n minCount = Geometry.stepCount(stepRadians, sweepRadians, minCount);\n return minCount;\n }\n /**\n * Return the number of strokes needed for given edgeLength curve.\n * @param options\n * @param minCount smallest allowed count\n * @param edgeLength\n */\n public static applyMaxEdgeLength(\n options: StrokeOptions | undefined, minCount: number, edgeLength: number,\n ): number {\n if (edgeLength < 0)\n edgeLength = - edgeLength;\n if (minCount < 1)\n minCount = 1;\n if (options && options.maxEdgeLength && options.maxEdgeLength * minCount < edgeLength) {\n minCount = Geometry.stepCount(options.maxEdgeLength, edgeLength, minCount);\n }\n return minCount;\n }\n /**\n * Determine a stroke count for a (partial) circular arc of given radius. This considers angle, maxEdgeLength,\n * chord, and minimum stroke.\n */\n public applyTolerancesToArc(radius: number, sweepRadians: number = Math.PI * 2): number {\n let numStrokes = 1;\n numStrokes = this.applyAngleTol(numStrokes, sweepRadians, Math.PI * 0.25);\n numStrokes = this.applyMaxEdgeLength(numStrokes, sweepRadians * radius);\n numStrokes = this.applyChordTol(numStrokes, radius, sweepRadians);\n numStrokes = this.applyMinStrokesPerPrimitive(numStrokes);\n return numStrokes;\n }\n /** Return stroke count which is the larger of existing count or count needed for circular arc chord tolerance condition. */\n public applyChordTol(minCount: number, radius: number, sweepRadians: number): number {\n if (this.chordTol && this.chordTol > 0.0 && this.chordTol < radius) {\n const a = this.chordTol;\n const stepRadians = 2.0 * Math.acos((1.0 - a / radius));\n minCount = Geometry.stepCount(stepRadians, sweepRadians, minCount);\n }\n return minCount;\n }\n /**\n * Return stroke count which is the larger of existing count or count needed for circular arc chord tol with given\n * arc length and radians\n */\n public applyChordTolToLengthAndRadians(minCount: number, length: number, sweepRadians: number): number {\n if (this.chordTol && this.chordTol > 0.0) {\n const radius = Geometry.conditionalDivideFraction(length, sweepRadians);\n if (radius !== undefined)\n return this.applyChordTol(minCount, radius, sweepRadians);\n }\n return minCount;\n }\n /** Return stroke count which is the larger of existing count or `this.minStrokesPerPrimitive` */\n public applyMinStrokesPerPrimitive(minCount: number): number {\n if (this.minStrokesPerPrimitive !== undefined && Number.isFinite(this.minStrokesPerPrimitive)\n && this.minStrokesPerPrimitive > minCount)\n minCount = this.minStrokesPerPrimitive;\n return minCount;\n }\n /**\n * Create `StrokeOptions` with defaults appropriate for curves.\n * * angle tolerance of 15 degrees.\n * * all others inactive.\n */\n public static createForCurves(): StrokeOptions {\n const options = new StrokeOptions();\n options.angleTol = Angle.createDegrees(15.0);\n return options;\n }\n /**\n * Create `StrokeOptions` with defaults appropriate for surfaces facets\n * * angle tolerance of 22.5 degrees.\n * * all others inactive.\n */\n public static createForFacets(): StrokeOptions {\n const options = new StrokeOptions();\n options.angleTol = Angle.createDegrees(22.5);\n return options;\n }\n}\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;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAa,aAAa;IAA1B;QAWE,qDAAqD;QAC9C,sBAAiB,GAAY,KAAK,CAAC;QA2B1C,8CAA8C;QACvC,yBAAoB,GAAG,EAAE,CAAC;IA0InC,CAAC;IAlKC,oCAAoC;IACpC,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC;IACnE,CAAC;IACD,IAAW,UAAU,CAAC,KAAc;QAClC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;IAC3B,CAAC;IACD,oCAAoC;IACpC,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC;IACrE,CAAC;IACD,IAAW,WAAW,CAAC,KAAc;QACnC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;IAC5B,CAAC;IACD,qCAAqC;IACrC,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC;IACvE,CAAC;IACD,IAAW,YAAY,CAAC,KAAc;QACpC,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;IAC7B,CAAC;IAKD,mCAAmC;IACnC,IAAW,WAAW;QACpB,OAAO,IAAI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IACD;;;OAGG;IACI,+BAA+B,CAAC,QAAgB,EAAE,MAAc,EAAE,YAAoB;QAC3F,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,GAAG,GAAG,EAAE;YACxC,MAAM,MAAM,GAAG,mBAAQ,CAAC,yBAAyB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;YACxE,IAAI,MAAM,KAAK,SAAS;gBACtB,OAAO,IAAI,CAAC,aAAa,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;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 +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,CAAC;QACjC,KAAK,MAAM,KAAK,IAAI,IAAI,EAAE;YACxB,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;SAC3B;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,+EAA+E;IACxE,eAAe;QACpB,OAAO,CAAC,CAAC;IACX,CAAC;IACD,2FAA2F;IACpF,wBAAwB,CAAC,SAAkC,EAAE,gBAAwB,CAAC,CAAC;QAC5F,OAAO,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAC5D,CAAC;IACD,uDAAuD;IAChD,YAAY,CAAC,OAAuB;QACzC,MAAM,KAAK,GAAG,IAAI,WAAW,EAAE,CAAC;QAChC,IAAI,KAAK,CAAC;QACV,KAAK,KAAK,IAAI,IAAI,CAAC,SAAS,EAAE;YAC5B,MAAM,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC,OAAO,CAAwB,CAAC;YACxE,IAAI,YAAY;gBACd,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SACrC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,qCAAqC;IAC9B,cAAc;QACnB,OAAO,IAAI,WAAW,EAAE,CAAC;IAC3B,CAAC;IACD;;;OAGG;IACI,WAAW,CAAC,KAAe;QAChC,IAAI,KAAK,IAAI,KAAK,YAAY,2BAAY,IAAI,KAAK,YAAY,WAAI,EAAE;YACnE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC3B,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,0CAA0C;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":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Curve\n */\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\nimport { AnyCurve } from \"./CurveChain\";\nimport { CurveCollection } from \"./CurveCollection\";\nimport { RecursiveCurveProcessor } from \"./CurveProcessor\";\nimport { GeometryQuery } from \"./GeometryQuery\";\nimport { Loop } from \"./Loop\";\nimport { ParityRegion } from \"./ParityRegion\";\nimport { StrokeOptions } from \"./StrokeOptions\";\n\n/**\n * * A `UnionRegion` is a collection of other planar region types -- `Loop` and `ParityRegion`.\n * * The composite is the union of the contained regions.\n * * A point is \"in\" the composite if it is \"in\" one or more of the contained regions.\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\n * @public\n */\nexport class UnionRegion extends CurveCollection {\n /** String name for schema properties */\n public readonly curveCollectionType = \"unionRegion\";\n /** Test if `other` is a `UnionRegion` */\n public isSameGeometryClass(other: GeometryQuery): boolean {\n return other instanceof UnionRegion;\n }\n /** Collection of Loop and ParityRegion children. */\n protected _children: Array<ParityRegion | Loop>;\n /** Return the array of regions */\n public override get children(): Array<ParityRegion | Loop> {\n return this._children;\n }\n /** Constructor -- initialize with no children */\n public constructor() {\n super();\n this._children = [];\n }\n /** Create a `UnionRegion` with given region children */\n public static create(...data: Array<ParityRegion | Loop>): UnionRegion {\n const result = new UnionRegion();\n for (const child of data) {\n result.tryAddChild(child);\n }\n return result;\n }\n /** Return the boundary type (5) of a corresponding MicroStation CurveVector */\n public dgnBoundaryType(): number {\n return 5;\n }\n /** Dispatch to more strongly typed `processor.announceUnionRegion(this, indexInParent)` */\n public announceToCurveProcessor(processor: RecursiveCurveProcessor, indexInParent: number = -1): void {\n return processor.announceUnionRegion(this, indexInParent);\n }\n /** Return structural clone with stroked primitives. */\n public cloneStroked(options?: StrokeOptions): UnionRegion {\n const clone = new UnionRegion();\n let child;\n for (child of this._children) {\n const childStrokes = child.cloneStroked(options) as ParityRegion | Loop;\n if (childStrokes)\n clone.children.push(childStrokes);\n }\n return clone;\n }\n /** Return new empty `UnionRegion` */\n public cloneEmptyPeer(): UnionRegion {\n return new UnionRegion();\n }\n /**\n * Try to add a child.\n * * Returns false if the `AnyCurve` child is not a region type.\n */\n public tryAddChild(child: AnyCurve): boolean {\n if (child && child instanceof ParityRegion || child instanceof Loop) {\n this._children.push(child);\n return true;\n }\n return false;\n }\n /** Return a child identified by index. */\n public getChild(i: number): Loop | ParityRegion | undefined {\n if (i < this._children.length)\n return this._children[i];\n return undefined;\n }\n /** Second step of double dispatch: call `handler.handleUnionRegion(this)` */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleUnionRegion(this);\n }\n}\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,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,CAAC;QACjC,KAAK,MAAM,KAAK,IAAI,IAAI,EAAE;YACxB,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;SAC3B;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,+EAA+E;IACxE,eAAe;QACpB,OAAO,CAAC,CAAC;IACX,CAAC;IACD,2FAA2F;IACpF,wBAAwB,CAAC,SAAkC,EAAE,gBAAwB,CAAC,CAAC;QAC5F,OAAO,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAC5D,CAAC;IACD,uDAAuD;IAChD,YAAY,CAAC,OAAuB;QACzC,MAAM,KAAK,GAAG,IAAI,WAAW,EAAE,CAAC;QAChC,IAAI,KAAK,CAAC;QACV,KAAK,KAAK,IAAI,IAAI,CAAC,SAAS,EAAE;YAC5B,MAAM,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;YACjD,IAAI,YAAY;gBACd,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SACrC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,qCAAqC;IAC9B,cAAc;QACnB,OAAO,IAAI,WAAW,EAAE,CAAC;IAC3B,CAAC;IACD;;;OAGG;IACI,WAAW,CAAC,KAAe;QAChC,IAAI,KAAK,IAAI,KAAK,YAAY,2BAAY,IAAI,KAAK,YAAY,WAAI,EAAE;YACnE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC3B,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,0CAA0C;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 \"./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 +1 @@
1
- {"version":3,"file":"AppendPlaneIntersectionStrokeHandler.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6CAAkE;AAGlE,kDAA+C;AAC/C,wEAAgE;AAChE,kDAA+E;AAC/E,gEAA6D;AAE7D,uEAAoE;AAEpE;;;GAGG;AACH,MAAa,oCAAqC,SAAQ,iDAAuB;IAe/E,+EAA+E;IACxE,cAAc;QACnB,IAAI,IAAI,CAAC,qBAAqB;YAC5B,OAAO,IAAI,CAAC,qBAAqB,CAAC;QACpC,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,YAAY,CAAC,CAAI,2FAA2F;IAC1H,CAAC;IAED,YAAmB,KAA6B,EAAE,aAAoC;QACpF,KAAK,EAAE,CAAC;QAvBF,eAAU,GAAW,CAAC,CAAC;QACvB,eAAU,GAAW,CAAC,CAAC;QAC/B,0DAA0D;QAClD,eAAU,GAAW,CAAC,CAAC;QACvB,eAAU,GAAW,CAAC,CAAC;QACvB,iBAAY,GAAW,CAAC,CAAC;QACzB,kBAAa,GAAW,CAAC,CAAC;QAkBhC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IAAI,CAAC,mBAAm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AAC,CAAC;QACvC,IAAI,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC;YAAE,IAAI,CAAC,cAAc,EAAE,CAAC;QACpD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;IACpC,CAAC;CACF;AA/ID,oFA+IC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Curve\n */\n\nimport { Geometry, PlaneAltitudeEvaluator } from \"../../Geometry\";\nimport { IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\nimport { Order2Bezier } from \"../../numerics/BezierPolynomials\";\nimport { Newton1dUnboundedApproximateDerivative } from \"../../numerics/Newton\";\nimport { CurveLocationDetail } from \"../CurveLocationDetail\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\nimport { NewtonRtoRStrokeHandler } from \"./NewtonRtoRStrokeHandler\";\n\n/**\n * Context for computing intersections of a CurvePrimitive with a plane.\n * @internal\n */\nexport class AppendPlaneIntersectionStrokeHandler extends NewtonRtoRStrokeHandler implements IStrokeHandler {\n private _curve: CurvePrimitive | undefined;\n private _plane: PlaneAltitudeEvaluator;\n private _intersections: CurveLocationDetail[];\n private _fractionA: number = 0;\n private _functionA: number = 0;\n // private derivativeA: number; <---- Not currently used\n private _functionB: number = 0;\n private _fractionB: number = 0;\n private _derivativeB: number = 0;\n private _numThisCurve: number = 0;\n // scratch vars for use within methods.\n private _ray: Ray3d;\n private _newtonSolver: Newton1dUnboundedApproximateDerivative;\n\n // Return the first defined curve among: this.parentCurvePrimitive, this.curve;\n public effectiveCurve(): CurvePrimitive | undefined {\n if (this._parentCurvePrimitive)\n return this._parentCurvePrimitive;\n return this._curve;\n }\n\n public get getDerivativeB() {\n return this._derivativeB; // <--- _derivativeB is not currently used anywhere. Provided getter to suppress lint error\n }\n\n public constructor(plane: PlaneAltitudeEvaluator, intersections: CurveLocationDetail[]) {\n super();\n this._plane = plane;\n this._intersections = intersections;\n this.startCurvePrimitive(undefined);\n this._ray = Ray3d.createZero();\n this._newtonSolver = new Newton1dUnboundedApproximateDerivative(this);\n }\n\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\n this._curve = curve;\n this._fractionA = 0.0;\n this._numThisCurve = 0;\n this._functionA = 0.0;\n // this.derivativeA = 0.0;\n }\n\n public endCurvePrimitive() {\n }\n\n public announceIntervalForUniformStepStrokes(\n cp: CurvePrimitive,\n numStrokes: number,\n fraction0: number,\n fraction1: number): void {\n this.startCurvePrimitive(cp);\n if (numStrokes < 1) numStrokes = 1;\n const df = 1.0 / numStrokes;\n for (let i = 0; i <= numStrokes; i++) {\n const fraction = Geometry.interpolate(fraction0, i * df, fraction1);\n cp.fractionToPointAndDerivative(fraction, this._ray);\n this.announcePointTangent(this._ray.origin, fraction, this._ray.direction);\n }\n }\n\n public announceSegmentInterval(\n _cp: CurvePrimitive,\n point0: Point3d,\n point1: Point3d,\n _numStrokes: number,\n fraction0: number,\n fraction1: number): void {\n const h0 = this._plane.altitude(point0);\n const h1 = this._plane.altitude(point1);\n if (h0 * h1 > 0.0)\n return;\n const fraction01 = Order2Bezier.solveCoffs(h0, h1);\n // let numIntersection = 0;\n if (fraction01 !== undefined) {\n // numIntersection++;\n const fraction = Geometry.interpolate(fraction0, fraction01, fraction1);\n this._newtonSolver.setX(fraction);\n if (this._newtonSolver.runIterations()) {\n this.announceSolutionFraction(this._newtonSolver.getX());\n }\n // this.intersections.push(CurveLocationDetail.createCurveFractionPoint(cp, fraction, cp.fractionToPoint(fraction)));\n }\n }\n\n private announceSolutionFraction(fraction: number) {\n const curve = this.effectiveCurve();\n if (curve) {\n this._ray = curve.fractionToPointAndDerivative(fraction, this._ray);\n this._intersections.push(CurveLocationDetail.createCurveFractionPoint(curve, fraction, this._ray.origin));\n }\n }\n\n public evaluate(fraction: number): boolean {\n const curve = this.effectiveCurve();\n if (!curve)\n return false;\n this.currentF = this._plane.altitude(curve.fractionToPoint(fraction));\n return true;\n }\n\n /**\n * * ASSUME both the \"A\" and \"B\" evaluations (fraction, function, and derivative) are known.\n * * If function value changed sign between, interpolate an approximate root and improve it with\n * the newton solver.\n */\n private searchInterval() {\n if (this._functionA * this._functionB > 0) return;\n if (this._functionA === 0) this.announceSolutionFraction(this._fractionA);\n if (this._functionB === 0) this.announceSolutionFraction(this._fractionB);\n if (this._functionA * this._functionB < 0) {\n const fraction = Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);\n if (fraction) {\n this._newtonSolver.setX(fraction);\n if (this._newtonSolver.runIterations())\n this.announceSolutionFraction(this._newtonSolver.getX());\n }\n }\n }\n\n /** Evaluate and save _functionB, _derivativeB, and _fractionB. */\n private evaluateB(xyz: Point3d, fraction: number, tangent: Vector3d) {\n this._functionB = this._plane.altitude(xyz);\n this._derivativeB = this._plane.velocity(tangent);\n this._fractionB = fraction;\n }\n\n /**\n * Announce point and tangent for evaluations.\n * * The function evaluation is saved as the \"B\" function point.\n * * The function point count is incremented\n * * If function point count is greater than 1, the current interval is searched.\n * * The just-evaluated point (\"B\") is saved as the \"old\" (\"A\") evaluation point.\n * @param xyz\n * @param fraction\n * @param tangent\n */\n public announcePointTangent(xyz: Point3d, fraction: number, tangent: Vector3d): void {\n this.evaluateB(xyz, fraction, tangent);\n if (this._numThisCurve++ > 0) this.searchInterval();\n this._functionA = this._functionB;\n this._fractionA = this._fractionB;\n }\n}\n"]}
1
+ {"version":3,"file":"AppendPlaneIntersectionStrokeHandler.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6CAAkE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IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;YACjH,IAAI,QAAQ,EAAE;gBACZ,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAClC,IAAI,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE;oBACpC,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC;aAC5D;SACF;IACH,CAAC;IAED,kEAAkE;IAC1D,SAAS,CAAC,GAAY,EAAE,QAAgB,EAAE,OAAiB;QACjE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAC5C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAED;;;;;;;;;OASG;IACI,oBAAoB,CAAC,GAAY,EAAE,QAAgB,EAAE,OAAiB;QAC3E,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QACvC,IAAI,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC;YAAE,IAAI,CAAC,cAAc,EAAE,CAAC;QACpD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;IACpC,CAAC;CACF;AA/ID,oFA+IC","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/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry, PlaneAltitudeEvaluator } from \"../../Geometry\";\r\nimport { IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Order2Bezier } from \"../../numerics/BezierPolynomials\";\r\nimport { Newton1dUnboundedApproximateDerivative } from \"../../numerics/Newton\";\r\nimport { CurveLocationDetail } from \"../CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { NewtonRtoRStrokeHandler } from \"./NewtonRtoRStrokeHandler\";\r\n\r\n/**\r\n * Context for computing intersections of a CurvePrimitive with a plane.\r\n * @internal\r\n */\r\nexport class AppendPlaneIntersectionStrokeHandler extends NewtonRtoRStrokeHandler implements IStrokeHandler {\r\n private _curve: CurvePrimitive | undefined;\r\n private _plane: PlaneAltitudeEvaluator;\r\n private _intersections: CurveLocationDetail[];\r\n private _fractionA: number = 0;\r\n private _functionA: number = 0;\r\n // private derivativeA: number; <---- Not currently used\r\n private _functionB: number = 0;\r\n private _fractionB: number = 0;\r\n private _derivativeB: number = 0;\r\n private _numThisCurve: number = 0;\r\n // scratch vars for use within methods.\r\n private _ray: Ray3d;\r\n private _newtonSolver: Newton1dUnboundedApproximateDerivative;\r\n\r\n // Return the first defined curve among: this.parentCurvePrimitive, this.curve;\r\n public effectiveCurve(): CurvePrimitive | undefined {\r\n if (this._parentCurvePrimitive)\r\n return this._parentCurvePrimitive;\r\n return this._curve;\r\n }\r\n\r\n public get getDerivativeB() {\r\n return this._derivativeB; // <--- _derivativeB is not currently used anywhere. Provided getter to suppress lint error\r\n }\r\n\r\n public constructor(plane: PlaneAltitudeEvaluator, intersections: CurveLocationDetail[]) {\r\n super();\r\n this._plane = plane;\r\n this._intersections = intersections;\r\n this.startCurvePrimitive(undefined);\r\n this._ray = Ray3d.createZero();\r\n this._newtonSolver = new Newton1dUnboundedApproximateDerivative(this);\r\n }\r\n\r\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\r\n this._curve = curve;\r\n this._fractionA = 0.0;\r\n this._numThisCurve = 0;\r\n this._functionA = 0.0;\r\n // this.derivativeA = 0.0;\r\n }\r\n\r\n public endCurvePrimitive() {\r\n }\r\n\r\n public announceIntervalForUniformStepStrokes(\r\n cp: CurvePrimitive,\r\n numStrokes: number,\r\n fraction0: number,\r\n fraction1: number): void {\r\n this.startCurvePrimitive(cp);\r\n if (numStrokes < 1) numStrokes = 1;\r\n const df = 1.0 / numStrokes;\r\n for (let i = 0; i <= numStrokes; i++) {\r\n const fraction = Geometry.interpolate(fraction0, i * df, fraction1);\r\n cp.fractionToPointAndDerivative(fraction, this._ray);\r\n this.announcePointTangent(this._ray.origin, fraction, this._ray.direction);\r\n }\r\n }\r\n\r\n public announceSegmentInterval(\r\n _cp: CurvePrimitive,\r\n point0: Point3d,\r\n point1: Point3d,\r\n _numStrokes: number,\r\n fraction0: number,\r\n fraction1: number): void {\r\n const h0 = this._plane.altitude(point0);\r\n const h1 = this._plane.altitude(point1);\r\n if (h0 * h1 > 0.0)\r\n return;\r\n const fraction01 = Order2Bezier.solveCoffs(h0, h1);\r\n // let numIntersection = 0;\r\n if (fraction01 !== undefined) {\r\n // numIntersection++;\r\n const fraction = Geometry.interpolate(fraction0, fraction01, fraction1);\r\n this._newtonSolver.setX(fraction);\r\n if (this._newtonSolver.runIterations()) {\r\n this.announceSolutionFraction(this._newtonSolver.getX());\r\n }\r\n // this.intersections.push(CurveLocationDetail.createCurveFractionPoint(cp, fraction, cp.fractionToPoint(fraction)));\r\n }\r\n }\r\n\r\n private announceSolutionFraction(fraction: number) {\r\n const curve = this.effectiveCurve();\r\n if (curve) {\r\n this._ray = curve.fractionToPointAndDerivative(fraction, this._ray);\r\n this._intersections.push(CurveLocationDetail.createCurveFractionPoint(curve, fraction, this._ray.origin));\r\n }\r\n }\r\n\r\n public evaluate(fraction: number): boolean {\r\n const curve = this.effectiveCurve();\r\n if (!curve)\r\n return false;\r\n this.currentF = this._plane.altitude(curve.fractionToPoint(fraction));\r\n return true;\r\n }\r\n\r\n /**\r\n * * ASSUME both the \"A\" and \"B\" evaluations (fraction, function, and derivative) are known.\r\n * * If function value changed sign between, interpolate an approximate root and improve it with\r\n * the newton solver.\r\n */\r\n private searchInterval() {\r\n if (this._functionA * this._functionB > 0) return;\r\n if (this._functionA === 0) this.announceSolutionFraction(this._fractionA);\r\n if (this._functionB === 0) this.announceSolutionFraction(this._fractionB);\r\n if (this._functionA * this._functionB < 0) {\r\n const fraction = Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);\r\n if (fraction) {\r\n this._newtonSolver.setX(fraction);\r\n if (this._newtonSolver.runIterations())\r\n this.announceSolutionFraction(this._newtonSolver.getX());\r\n }\r\n }\r\n }\r\n\r\n /** Evaluate and save _functionB, _derivativeB, and _fractionB. */\r\n private evaluateB(xyz: Point3d, fraction: number, tangent: Vector3d) {\r\n this._functionB = this._plane.altitude(xyz);\r\n this._derivativeB = this._plane.velocity(tangent);\r\n this._fractionB = fraction;\r\n }\r\n\r\n /**\r\n * Announce point and tangent for evaluations.\r\n * * The function evaluation is saved as the \"B\" function point.\r\n * * The function point count is incremented\r\n * * If function point count is greater than 1, the current interval is searched.\r\n * * The just-evaluated point (\"B\") is saved as the \"old\" (\"A\") evaluation point.\r\n * @param xyz\r\n * @param fraction\r\n * @param tangent\r\n */\r\n public announcePointTangent(xyz: Point3d, fraction: number, tangent: Vector3d): void {\r\n this.evaluateB(xyz, fraction, tangent);\r\n if (this._numThisCurve++ > 0) this.searchInterval();\r\n this._functionA = this._functionB;\r\n this._fractionA = this._fractionB;\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ChainCollectorContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/ChainCollectorContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAM/F,wDAAiD;AACjD,sDAAmD;AACnD,kCAA+B;AAC/B,kCAA+B;AAE/B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAa,qBAAqB;IAOhC;;OAEG;IACK,YAAY,CAAC,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,QAAQ,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC;QAC/F,qBAAqB,CAAC,aAAa,GAAG,UAAU,CAAC,UAAU,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC;QACjG,OAAO,QAAQ;YACb,CAAC,CAAC,CAAC,qBAAqB,CAAC,aAAa,CAAC,eAAe,CAAC,qBAAqB,CAAC,aAAa,CAAC;YAC3F,CAAC,CAAC,CAAC,qBAAqB,CAAC,aAAa,CAAC,aAAa,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC;IAC9F,CAAC;CACF;AAxJD,sDAwJC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Curve\n */\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\nimport { BagOfCurves } from \"../CurveCollection\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\nimport { Loop } from \"../Loop\";\nimport { Path } from \"../Path\";\n\n/**\n * Manage a growing array of arrays of curve primitives that are to be joined \"head to tail\" in paths.\n * * The caller makes a sequence of calls to announce individual primitives.\n * * The collector has 2 use cases in mind, controlled by `searchAllPaths` flag on `chainCollectorContext.announceCurvePrimitive`\n * * (a) \"simple chains\" -- the caller has the curve primitives in order and just needs to have them monitored for coordinate breaks that indicate transition to a new chain.\n * * The collector needs to watch for connection to the most recent path but not search for prior paths to join to instead.\n * * (b) \"mixed\" primitives -- primitive order is NOT significant for chain assembly.\n * * The collector needs to search all prior paths at both start and end, and consider connection to both the start and end of each new primitive.\n * * The per-curve announcement is\n * * chainCollector.announceCurvePrimitive (curve, searchAllPaths).\n * * When all curves have been announced, the call to grab the paths option\n * * formLoopsIfClosed\n * * If true, convert closed paths to `Loop`, open paths to `Path`\n * * If false, convert all paths (open or not) to `Path`\n * * Usage pattern is\n * * initialization: `context = new ChainCollectorContext (makeClones: boolean)`\n * * many times: ` context.announceCurvePrimitive (primitive, searchAllPaths)`\n * * end: ` result = context.grabResults (formLoopsIfClosed)`\n * @internal\n */\nexport class ChainCollectorContext {\n private _chains: CurvePrimitive[][];\n private _makeClones: boolean;\n\n private static _staticPointA: Point3d;\n private static _staticPointB: Point3d;\n\n /**\n * Push a new chain with an optional first primitive.\n */\n private pushNewChain(primitive?: CurvePrimitive) {\n const chain = [];\n if (primitive)\n chain.push(primitive);\n this._chains.push(chain);\n }\n private findOrCreateTailChain(): CurvePrimitive[] {\n if (this._chains.length === 0)\n this.pushNewChain();\n return this._chains[this._chains.length - 1];\n }\n private _xyzWork0?: Point3d;\n private findAnyChainToConnect(xyz: Point3d): { chainIndex: number, atEnd: boolean } | undefined {\n\n for (let chainIndexA = 0; chainIndexA < this._chains.length; chainIndexA++) {\n const path = this._chains[chainIndexA];\n this._xyzWork1 = path[path.length - 1].endPoint(this._xyzWork1);\n if (this._xyzWork1.isAlmostEqual(xyz))\n return { chainIndex: chainIndexA, atEnd: true };\n this._xyzWork1 = path[0].startPoint(this._xyzWork1);\n if (this._xyzWork1.isAlmostEqual(xyz))\n return { chainIndex: chainIndexA, atEnd: false };\n }\n return undefined;\n }\n\n /** Initialize with an empty array of chains.\n * @param makeClones if true, all CurvePrimitives sent to `announceCurvePrimitive` is immediately cloned. If false, the reference to the original curve is maintained.\n */\n public constructor(makeClones: boolean) {\n this._chains = [];\n this._makeClones = makeClones;\n }\n\n private _xyzWork1?: Point3d;\n\n /** Announce a curve primitive\n * * searchAllChains controls the extent of search for connecting points.\n * * false ==> only consider connection to most recent chain.\n * * true ==> search for any connection, reversing direction as needed.\n * * Otherwise start a new chain.\n */\n public announceCurvePrimitive(candidate: CurvePrimitive, searchAllChains: boolean = false) {\n if (candidate) {\n if (this._makeClones) {\n const candidate1 = candidate.clone();\n if (!candidate1 || !(candidate1 instanceof CurvePrimitive))\n return;\n this.transferMarkup(candidate, candidate1);\n candidate = candidate1;\n }\n if (!searchAllChains) {\n const activeChain = this.findOrCreateTailChain();\n if (activeChain.length === 0 || !ChainCollectorContext.needBreakBetweenPrimitives(activeChain[activeChain.length - 1], candidate))\n activeChain.push(candidate);\n else\n this.pushNewChain(candidate);\n } else {\n this._xyzWork0 = candidate.startPoint(this._xyzWork0);\n let connect = this.findAnyChainToConnect(this._xyzWork0);\n if (connect) {\n if (connect.atEnd) {\n this._chains[connect.chainIndex].push(candidate);\n } else {\n candidate.reverseInPlace();\n this._chains[connect.chainIndex].splice(0, 0, candidate);\n }\n } else {\n this._xyzWork0 = candidate.endPoint(this._xyzWork0);\n connect = this.findAnyChainToConnect(this._xyzWork0);\n if (connect) { // START of new primitive ..\n if (connect.atEnd) {\n candidate.reverseInPlace();\n this._chains[connect.chainIndex].push(candidate);\n } else {\n this._chains[connect.chainIndex].splice(0, 0, candidate);\n }\n } else {\n this._chains.push([candidate]);\n }\n }\n }\n }\n }\n /** Transfer markup (e.g. startCut, endCut) from source to destination */\n private transferMarkup(source: CurvePrimitive, dest: CurvePrimitive) {\n if (source && dest) {\n dest.startCut = source.startCut;\n dest.endCut = source.endCut;\n }\n }\n /** turn an array of curve primitives into the simplest possible strongly typed curve structure.\n * * The input array is assumed to be connected appropriately to act as the curves of a Path.\n * * When a path is created the curves array is CAPTURED.\n */\n private promoteArrayToCurves(curves: CurvePrimitive[], makeLoopIfClosed: boolean): CurvePrimitive | Path | Loop | undefined {\n if (curves.length === 0)\n return undefined;\n if (makeLoopIfClosed) {\n ChainCollectorContext._staticPointA = curves[0].startPoint(ChainCollectorContext._staticPointA);\n ChainCollectorContext._staticPointB = curves[curves.length - 1].endPoint(ChainCollectorContext._staticPointB);\n if (ChainCollectorContext._staticPointA.isAlmostEqual(ChainCollectorContext._staticPointB))\n return Loop.createArray(curves);\n }\n if (curves.length === 1)\n return curves[0];\n return Path.createArray(curves);\n }\n /** Return the collected results, structured as the simplest possible type. */\n public grabResult(makeLoopIfClosed: boolean = false): CurvePrimitive | Path | BagOfCurves | Loop | undefined {\n const chains = this._chains;\n if (chains.length === 0)\n return undefined;\n if (chains.length === 1)\n return this.promoteArrayToCurves(chains[0], makeLoopIfClosed);\n const bag = BagOfCurves.create();\n for (const chain of chains) {\n const q = this.promoteArrayToCurves(chain, makeLoopIfClosed);\n bag.tryAddChild(q);\n }\n return bag;\n }\n /** test if there is a break between primitiveA and primitiveB, due to any condition such as\n * * primitiveA.endCut\n * * primitiveB.startCut\n * * physical gap between primitives.\n */\n public static needBreakBetweenPrimitives(primitiveA: CurvePrimitive | undefined, primitiveB: CurvePrimitive | undefined, isXYOnly: boolean = false): boolean {\n if (primitiveA === undefined)\n return true;\n if (primitiveB === undefined)\n return true;\n if (primitiveA.endCut !== undefined)\n return true;\n if (primitiveB.startCut !== undefined)\n return true;\n ChainCollectorContext._staticPointA = primitiveA.endPoint(ChainCollectorContext._staticPointA);\n ChainCollectorContext._staticPointB = primitiveB.startPoint(ChainCollectorContext._staticPointB);\n return isXYOnly\n ? !ChainCollectorContext._staticPointA.isAlmostEqualXY(ChainCollectorContext._staticPointB)\n : !ChainCollectorContext._staticPointA.isAlmostEqual(ChainCollectorContext._staticPointB);\n }\n}\n"]}
1
+ {"version":3,"file":"ChainCollectorContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/ChainCollectorContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAM/F,wDAAiD;AACjD,sDAAmD;AACnD,kCAA+B;AAC/B,kCAA+B;AAE/B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAa,qBAAqB;IAOhC;;OAEG;IACK,YAAY,CAAC,SAA0B;QAC7C,MAAM,KAAK,GAAG,EAAE,CAAC;QACjB,IAAI,SAAS;YACX,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IACO,qBAAqB;QAC3B,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;YAC3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,CAAC,CAAC,qBAAqB,CAAC,aAAa,CAAC,aAAa,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC;IAC9F,CAAC;CACF;AAxJD,sDAwJC","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 { Point3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { BagOfCurves } from \"../CurveCollection\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { Loop } from \"../Loop\";\r\nimport { Path } from \"../Path\";\r\n\r\n/**\r\n * Manage a growing array of arrays of curve primitives that are to be joined \"head to tail\" in paths.\r\n * * The caller makes a sequence of calls to announce individual primitives.\r\n * * The collector has 2 use cases in mind, controlled by `searchAllPaths` flag on `chainCollectorContext.announceCurvePrimitive`\r\n * * (a) \"simple chains\" -- the caller has the curve primitives in order and just needs to have them monitored for coordinate breaks that indicate transition to a new chain.\r\n * * The collector needs to watch for connection to the most recent path but not search for prior paths to join to instead.\r\n * * (b) \"mixed\" primitives -- primitive order is NOT significant for chain assembly.\r\n * * The collector needs to search all prior paths at both start and end, and consider connection to both the start and end of each new primitive.\r\n * * The per-curve announcement is\r\n * * chainCollector.announceCurvePrimitive (curve, searchAllPaths).\r\n * * When all curves have been announced, the call to grab the paths option\r\n * * formLoopsIfClosed\r\n * * If true, convert closed paths to `Loop`, open paths to `Path`\r\n * * If false, convert all paths (open or not) to `Path`\r\n * * Usage pattern is\r\n * * initialization: `context = new ChainCollectorContext (makeClones: boolean)`\r\n * * many times: ` context.announceCurvePrimitive (primitive, searchAllPaths)`\r\n * * end: ` result = context.grabResults (formLoopsIfClosed)`\r\n * @internal\r\n */\r\nexport class ChainCollectorContext {\r\n private _chains: CurvePrimitive[][];\r\n private _makeClones: boolean;\r\n\r\n private static _staticPointA: Point3d;\r\n private static _staticPointB: Point3d;\r\n\r\n /**\r\n * Push a new chain with an optional first primitive.\r\n */\r\n private pushNewChain(primitive?: CurvePrimitive) {\r\n const chain = [];\r\n if (primitive)\r\n chain.push(primitive);\r\n this._chains.push(chain);\r\n }\r\n private findOrCreateTailChain(): CurvePrimitive[] {\r\n if (this._chains.length === 0)\r\n this.pushNewChain();\r\n return this._chains[this._chains.length - 1];\r\n }\r\n private _xyzWork0?: Point3d;\r\n private findAnyChainToConnect(xyz: Point3d): { chainIndex: number, atEnd: boolean } | undefined {\r\n\r\n for (let chainIndexA = 0; chainIndexA < this._chains.length; chainIndexA++) {\r\n const path = this._chains[chainIndexA];\r\n this._xyzWork1 = path[path.length - 1].endPoint(this._xyzWork1);\r\n if (this._xyzWork1.isAlmostEqual(xyz))\r\n return { chainIndex: chainIndexA, atEnd: true };\r\n this._xyzWork1 = path[0].startPoint(this._xyzWork1);\r\n if (this._xyzWork1.isAlmostEqual(xyz))\r\n return { chainIndex: chainIndexA, atEnd: false };\r\n }\r\n return undefined;\r\n }\r\n\r\n /** Initialize with an empty array of chains.\r\n * @param makeClones if true, all CurvePrimitives sent to `announceCurvePrimitive` is immediately cloned. If false, the reference to the original curve is maintained.\r\n */\r\n public constructor(makeClones: boolean) {\r\n this._chains = [];\r\n this._makeClones = makeClones;\r\n }\r\n\r\n private _xyzWork1?: Point3d;\r\n\r\n /** Announce a curve primitive\r\n * * searchAllChains controls the extent of search for connecting points.\r\n * * false ==> only consider connection to most recent chain.\r\n * * true ==> search for any connection, reversing direction as needed.\r\n * * Otherwise start a new chain.\r\n */\r\n public announceCurvePrimitive(candidate: CurvePrimitive, searchAllChains: boolean = false) {\r\n if (candidate) {\r\n if (this._makeClones) {\r\n const candidate1 = candidate.clone();\r\n if (!candidate1 || !(candidate1 instanceof CurvePrimitive))\r\n return;\r\n this.transferMarkup(candidate, candidate1);\r\n candidate = candidate1;\r\n }\r\n if (!searchAllChains) {\r\n const activeChain = this.findOrCreateTailChain();\r\n if (activeChain.length === 0 || !ChainCollectorContext.needBreakBetweenPrimitives(activeChain[activeChain.length - 1], candidate))\r\n activeChain.push(candidate);\r\n else\r\n this.pushNewChain(candidate);\r\n } else {\r\n this._xyzWork0 = candidate.startPoint(this._xyzWork0);\r\n let connect = this.findAnyChainToConnect(this._xyzWork0);\r\n if (connect) {\r\n if (connect.atEnd) {\r\n this._chains[connect.chainIndex].push(candidate);\r\n } else {\r\n candidate.reverseInPlace();\r\n this._chains[connect.chainIndex].splice(0, 0, candidate);\r\n }\r\n } else {\r\n this._xyzWork0 = candidate.endPoint(this._xyzWork0);\r\n connect = this.findAnyChainToConnect(this._xyzWork0);\r\n if (connect) { // START of new primitive ..\r\n if (connect.atEnd) {\r\n candidate.reverseInPlace();\r\n this._chains[connect.chainIndex].push(candidate);\r\n } else {\r\n this._chains[connect.chainIndex].splice(0, 0, candidate);\r\n }\r\n } else {\r\n this._chains.push([candidate]);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n /** Transfer markup (e.g. startCut, endCut) from source to destination */\r\n private transferMarkup(source: CurvePrimitive, dest: CurvePrimitive) {\r\n if (source && dest) {\r\n dest.startCut = source.startCut;\r\n dest.endCut = source.endCut;\r\n }\r\n }\r\n /** turn an array of curve primitives into the simplest possible strongly typed curve structure.\r\n * * The input array is assumed to be connected appropriately to act as the curves of a Path.\r\n * * When a path is created the curves array is CAPTURED.\r\n */\r\n private promoteArrayToCurves(curves: CurvePrimitive[], makeLoopIfClosed: boolean): CurvePrimitive | Path | Loop | undefined {\r\n if (curves.length === 0)\r\n return undefined;\r\n if (makeLoopIfClosed) {\r\n ChainCollectorContext._staticPointA = curves[0].startPoint(ChainCollectorContext._staticPointA);\r\n ChainCollectorContext._staticPointB = curves[curves.length - 1].endPoint(ChainCollectorContext._staticPointB);\r\n if (ChainCollectorContext._staticPointA.isAlmostEqual(ChainCollectorContext._staticPointB))\r\n return Loop.createArray(curves);\r\n }\r\n if (curves.length === 1)\r\n return curves[0];\r\n return Path.createArray(curves);\r\n }\r\n /** Return the collected results, structured as the simplest possible type. */\r\n public grabResult(makeLoopIfClosed: boolean = false): CurvePrimitive | Path | BagOfCurves | Loop | undefined {\r\n const chains = this._chains;\r\n if (chains.length === 0)\r\n return undefined;\r\n if (chains.length === 1)\r\n return this.promoteArrayToCurves(chains[0], makeLoopIfClosed);\r\n const bag = BagOfCurves.create();\r\n for (const chain of chains) {\r\n const q = this.promoteArrayToCurves(chain, makeLoopIfClosed);\r\n bag.tryAddChild(q);\r\n }\r\n return bag;\r\n }\r\n /** test if there is a break between primitiveA and primitiveB, due to any condition such as\r\n * * primitiveA.endCut\r\n * * primitiveB.startCut\r\n * * physical gap between primitives.\r\n */\r\n public static needBreakBetweenPrimitives(primitiveA: CurvePrimitive | undefined, primitiveB: CurvePrimitive | undefined, isXYOnly: boolean = false): boolean {\r\n if (primitiveA === undefined)\r\n return true;\r\n if (primitiveB === undefined)\r\n return true;\r\n if (primitiveA.endCut !== undefined)\r\n return true;\r\n if (primitiveB.startCut !== undefined)\r\n return true;\r\n ChainCollectorContext._staticPointA = primitiveA.endPoint(ChainCollectorContext._staticPointA);\r\n ChainCollectorContext._staticPointB = primitiveB.startPoint(ChainCollectorContext._staticPointB);\r\n return isXYOnly\r\n ? !ChainCollectorContext._staticPointA.isAlmostEqualXY(ChainCollectorContext._staticPointB)\r\n : !ChainCollectorContext._staticPointA.isAlmostEqual(ChainCollectorContext._staticPointB);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"CloneCurvesContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/CloneCurvesContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,wDAA8E;AAE9E,sDAAqE;AAErE;;;;GAIG;AACH,MAAa,kBAAmB,SAAQ,iDAAgC;IAGtE,YAAsB,SAAqB;QACzC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,C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AAC,CAAC,CAAC;YACnD,IAAI,MAAM,YAAY,4BAAU,IAAI,MAAM,YAAY,6BAAW;gBAC/D,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;oBACpB,KAAK,MAAM,EAAE,IAAI,CAAC,EAAE;wBAClB,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;qBACxB;iBACF;qBAAM;oBACL,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;iBACvB;SACJ;IACH,CAAC;CACF;AA/CD,gDA+CC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Curve\n */\n\nimport { Transform } from \"../../geometry3d/Transform\";\nimport { BagOfCurves, CurveChain, CurveCollection } from \"../CurveCollection\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\nimport { RecursiveCurveProcessorWithStack } from \"../CurveProcessor\";\n\n/**\n * Algorithmic class for cloning curve collections.\n * * recurse through collection nodes, building image nodes as needed and inserting clones of children.\n * * for individual primitive, invoke doClone (protected) for direct clone; insert into parent\n */\nexport class CloneCurvesContext extends RecursiveCurveProcessorWithStack {\n protected _result: CurveCollection | undefined;\n private _transform: Transform | undefined;\n protected constructor(transform?: Transform) {\n super();\n this._transform = transform;\n this._result = undefined;\n }\n public static clone(target: CurveCollection, transform?: Transform): CurveCollection | undefined {\n const context = new CloneCurvesContext(transform);\n target.announceToCurveProcessor(context);\n return context._result;\n }\n public override enter(c: CurveCollection) {\n if (c instanceof CurveCollection)\n super.enter(c.cloneEmptyPeer());\n }\n public override leave(): CurveCollection | undefined {\n const result = super.leave();\n if (result) {\n if (this._stack.length === 0) // this should only happen once !!!\n this._result = result;\n else // push this result to top of stack.\n this._stack[this._stack.length - 1].tryAddChild(result);\n }\n return result;\n }\n // specialized clone methods override this (and allow announceCurvePrimitive to insert to parent)\n protected doClone(primitive: CurvePrimitive): CurvePrimitive | CurvePrimitive[] | undefined {\n if (this._transform)\n return primitive.cloneTransformed(this._transform);\n return primitive.clone();\n }\n public override announceCurvePrimitive(primitive: CurvePrimitive, _indexInParent: number): void {\n const c = this.doClone(primitive);\n if (c !== undefined && this._stack.length > 0) {\n const parent = this._stack[this._stack.length - 1];\n if (parent instanceof CurveChain || parent instanceof BagOfCurves)\n if (Array.isArray(c)) {\n for (const c1 of c) {\n parent.tryAddChild(c1);\n }\n } else {\n parent.tryAddChild(c);\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"CloneCurvesContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/CloneCurvesContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,wDAA8E;AAE9E,sDAAqE;AAErE;;;;GAIG;AACH,MAAa,kBAAmB,SAAQ,iDAAgC;IAGtE,YAAsB,SAAqB;QACzC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;IAC3B,CAAC;IACM,MAAM,CAAC,KAAK,CAAC,MAAuB,EAAE,SAAqB;QAChE,MAAM,OAAO,GAAG,IAAI,kBAAkB,CAAC,SAAS,CAAC,CAAC;QAClD,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;QACzC,OAAO,OAAO,CAAC,OAAO,CAAC;IACzB,CAAC;IACe,KAAK,CAAC,CAAkB;QACtC,IAAI,CAAC,YAAY,iCAAe;YAC9B,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC;IACpC,CAAC;IACe,KAAK;QACnB,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;QAC7B,IAAI,MAAM,EAAE;YACV,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,mCAAmC;gBAC/D,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;iBACnB,oCAAoC;gBACvC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;SAC3D;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,iGAAiG;IACvF,OAAO,CAAC,SAAyB;QACzC,IAAI,IAAI,CAAC,UAAU;YACjB,OAAO,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACrD,OAAO,SAAS,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;IACe,sBAAsB,CAAC,SAAyB,EAAE,cAAsB;QACtF,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAClC,IAAI,CAAC,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACnD,IAAI,MAAM,YAAY,4BAAU,IAAI,MAAM,YAAY,6BAAW;gBAC/D,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;oBACpB,KAAK,MAAM,EAAE,IAAI,CAAC,EAAE;wBAClB,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;qBACxB;iBACF;qBAAM;oBACL,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;iBACvB;SACJ;IACH,CAAC;CACF;AA/CD,gDA+CC","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/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Transform } from \"../../geometry3d/Transform\";\r\nimport { BagOfCurves, CurveChain, CurveCollection } from \"../CurveCollection\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { RecursiveCurveProcessorWithStack } from \"../CurveProcessor\";\r\n\r\n/**\r\n * Algorithmic class for cloning curve collections.\r\n * * recurse through collection nodes, building image nodes as needed and inserting clones of children.\r\n * * for individual primitive, invoke doClone (protected) for direct clone; insert into parent\r\n */\r\nexport class CloneCurvesContext extends RecursiveCurveProcessorWithStack {\r\n protected _result: CurveCollection | undefined;\r\n private _transform: Transform | undefined;\r\n protected constructor(transform?: Transform) {\r\n super();\r\n this._transform = transform;\r\n this._result = undefined;\r\n }\r\n public static clone(target: CurveCollection, transform?: Transform): CurveCollection | undefined {\r\n const context = new CloneCurvesContext(transform);\r\n target.announceToCurveProcessor(context);\r\n return context._result;\r\n }\r\n public override enter(c: CurveCollection) {\r\n if (c instanceof CurveCollection)\r\n super.enter(c.cloneEmptyPeer());\r\n }\r\n public override leave(): CurveCollection | undefined {\r\n const result = super.leave();\r\n if (result) {\r\n if (this._stack.length === 0) // this should only happen once !!!\r\n this._result = result;\r\n else // push this result to top of stack.\r\n this._stack[this._stack.length - 1].tryAddChild(result);\r\n }\r\n return result;\r\n }\r\n // specialized clone methods override this (and allow announceCurvePrimitive to insert to parent)\r\n protected doClone(primitive: CurvePrimitive): CurvePrimitive | CurvePrimitive[] | undefined {\r\n if (this._transform)\r\n return primitive.cloneTransformed(this._transform);\r\n return primitive.clone();\r\n }\r\n public override announceCurvePrimitive(primitive: CurvePrimitive, _indexInParent: number): void {\r\n const c = this.doClone(primitive);\r\n if (c !== undefined && this._stack.length > 0) {\r\n const parent = this._stack[this._stack.length - 1];\r\n if (parent instanceof CurveChain || parent instanceof BagOfCurves)\r\n if (Array.isArray(c)) {\r\n for (const c1 of c) {\r\n parent.tryAddChild(c1);\r\n }\r\n } else {\r\n parent.tryAddChild(c);\r\n }\r\n }\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"CloneWithExpandedLineStrings.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/CloneWithExpandedLineStrings.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAQ/F,oDAAiD;AACjD,kDAA+C;AAC/C,6DAA0D;AAE1D;;;GAGG;AACH,MAAa,4BAA6B,SAAQ,uCAAkB;IAClE;QACE,4BAA4B;QAC5B,KAAK,CAAC,SAAS,CAAC,CAAC;IACnB,CAAC;IACD,mCAAmC;IAChB,OAAO,CAAC,SAAyB;QAClD,IAAI,SAAS,YAAY,2BAAY,IAAI,SAAS,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE;YAClE,MAAM,YAAY,GAAG,SAAS,CAAC,YAAY,CAAC;YAC5C,MAAM,CAAC,GAAG,YAAY,CAAC,MAAM,CAAC;YAC9B,MAAM,QAAQ,GAAG,EAAE,CAAC;YACpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;gBAC9B,QAAQ,CAAC,IAAI,CAAC,6BAAa,CAAC,aAAa,CAAC,YAAY,CAAC,+BAA+B,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,+BAA+B,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;aAClJ;YACD,OAAO,QAAQ,CAAC;SACjB;QACD,OAAO,SAAS,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;IACM,MAAM,CAAU,KAAK,CAAC,MAAuB;QAClD,MAAM,OAAO,GAAG,IAAI,4BAA4B,EAAE,CAAC;QACnD,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;QACzC,OAAO,OAAO,CAAC,OAA0B,CAAC;IAC5C,CAAC;CACF;AAvBD,oEAuBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Curve\n */\n\nimport { CurveCollection } from \"../CurveCollection\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\nimport { LineSegment3d } from \"../LineSegment3d\";\nimport { LineString3d } from \"../LineString3d\";\nimport { CloneCurvesContext } from \"./CloneCurvesContext\";\n\n/**\n * Algorithmic class for cloning with linestrings expanded to line segments\n * @internal\n */\nexport class CloneWithExpandedLineStrings extends CloneCurvesContext {\n public constructor() {\n // we have no transform ....\n super(undefined);\n }\n // We know we have no transform !!!\n protected override doClone(primitive: CurvePrimitive): CurvePrimitive | CurvePrimitive[] {\n if (primitive instanceof LineString3d && primitive.numPoints() > 1) {\n const packedPoints = primitive.packedPoints;\n const n = packedPoints.length;\n const segments = [];\n for (let i = 0; i + 1 < n; i++) {\n segments.push(LineSegment3d.createCapture(packedPoints.getPoint3dAtUncheckedPointIndex(i), packedPoints.getPoint3dAtUncheckedPointIndex(i + 1)));\n }\n return segments;\n }\n return primitive.clone();\n }\n public static override clone(target: CurveCollection): CurveCollection {\n const context = new CloneWithExpandedLineStrings();\n target.announceToCurveProcessor(context);\n return context._result as CurveCollection;\n }\n}\n"]}
1
+ {"version":3,"file":"CloneWithExpandedLineStrings.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/CloneWithExpandedLineStrings.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAQ/F,oDAAiD;AACjD,kDAA+C;AAC/C,6DAA0D;AAE1D;;;GAGG;AACH,MAAa,4BAA6B,SAAQ,uCAAkB;IAClE;QACE,4BAA4B;QAC5B,KAAK,CAAC,SAAS,CAAC,CAAC;IACnB,CAAC;IACD,mCAAmC;IAChB,OAAO,CAAC,SAAyB;QAClD,IAAI,SAAS,YAAY,2BAAY,IAAI,SAAS,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE;YAClE,MAAM,YAAY,GAAG,SAAS,CAAC,YAAY,CAAC;YAC5C,MAAM,CAAC,GAAG,YAAY,CAAC,MAAM,CAAC;YAC9B,MAAM,QAAQ,GAAG,EAAE,CAAC;YACpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;gBAC9B,QAAQ,CAAC,IAAI,CAAC,6BAAa,CAAC,aAAa,CAAC,YAAY,CAAC,+BAA+B,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,+BAA+B,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;aAClJ;YACD,OAAO,QAAQ,CAAC;SACjB;QACD,OAAO,SAAS,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;IACM,MAAM,CAAU,KAAK,CAAC,MAAuB;QAClD,MAAM,OAAO,GAAG,IAAI,4BAA4B,EAAE,CAAC;QACnD,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;QACzC,OAAO,OAAO,CAAC,OAA0B,CAAC;IAC5C,CAAC;CACF;AAvBD,oEAuBC","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 { CurveCollection } from \"../CurveCollection\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { LineSegment3d } from \"../LineSegment3d\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { CloneCurvesContext } from \"./CloneCurvesContext\";\r\n\r\n/**\r\n * Algorithmic class for cloning with linestrings expanded to line segments\r\n * @internal\r\n */\r\nexport class CloneWithExpandedLineStrings extends CloneCurvesContext {\r\n public constructor() {\r\n // we have no transform ....\r\n super(undefined);\r\n }\r\n // We know we have no transform !!!\r\n protected override doClone(primitive: CurvePrimitive): CurvePrimitive | CurvePrimitive[] {\r\n if (primitive instanceof LineString3d && primitive.numPoints() > 1) {\r\n const packedPoints = primitive.packedPoints;\r\n const n = packedPoints.length;\r\n const segments = [];\r\n for (let i = 0; i + 1 < n; i++) {\r\n segments.push(LineSegment3d.createCapture(packedPoints.getPoint3dAtUncheckedPointIndex(i), packedPoints.getPoint3dAtUncheckedPointIndex(i + 1)));\r\n }\r\n return segments;\r\n }\r\n return primitive.clone();\r\n }\r\n public static override clone(target: CurveCollection): CurveCollection {\r\n const context = new CloneWithExpandedLineStrings();\r\n target.announceToCurveProcessor(context);\r\n return context._result as CurveCollection;\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ClosestPointStrokeHandler.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/ClosestPointStrokeHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6CAA0C;AAE1C,sEAAqE;AACrE,kDAA+C;AAC/C,kDAA+E;AAC/E,wDAAqF;AACrF,gEAA6D;AAE7D,uEAAoE;AAEpE;;;GAGG;AACH,MAAa,yBAA0B,SAAQ,iDAAuB;IAepE,YAAmB,UAAmB,EAAE,MAAmC;QACzE,KAAK,EAAE,CAAC;QAXF,eAAU,GAAW,CAAC,CAAC;QACvB,eAAU,GAAW,CAAC,CAAC;QACvB,eAAU,GAAW,CAAC,CAAC;QACvB,eAAU,GAAW,CAAC,CAAC;QACvB,kBAAa,GAAW,CAAC,CAAC;QAQhC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,yBAAO,CAAC,MAAM,EAAE,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,aAAK,CAAC,UAAU,EAAE,CAAC;QACnC,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;QACpC,IAAI,CAAC,aAAa,GAAG,IAAI,+CAAsC,CAAC,IAAI,CAAC,CAAC;IACxE,CAAC;IAEM,WAAW;QAChB,IAAI,IAAI,CAAC,aAAa,E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AAI,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;CACF;AA3ID,8DA2IC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Curve\n */\n\nimport { Geometry } from \"../../Geometry\";\nimport { IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\nimport { Newton1dUnboundedApproximateDerivative } from \"../../numerics/Newton\";\nimport { CurveExtendOptions, VariantCurveExtendParameter } from \"../CurveExtendMode\";\nimport { CurveLocationDetail } from \"../CurveLocationDetail\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\nimport { NewtonRtoRStrokeHandler } from \"./NewtonRtoRStrokeHandler\";\n\n/**\n * Context for searching for the closest point to a CurvePrimitive.\n * @internal\n */\nexport class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler implements IStrokeHandler {\n private _curve: CurvePrimitive | undefined;\n private _closestPoint: CurveLocationDetail | undefined;\n private _spacePoint: Point3d;\n private _extend: VariantCurveExtendParameter;\n private _fractionA: number = 0;\n private _functionA: number = 0;\n private _functionB: number = 0;\n private _fractionB: number = 0;\n private _numThisCurve: number = 0;\n // scratch vars for use within methods.\n private _workPoint: Point3d;\n private _workRay: Ray3d;\n private _newtonSolver: Newton1dUnboundedApproximateDerivative;\n\n public constructor(spacePoint: Point3d, extend: VariantCurveExtendParameter) {\n super();\n this._spacePoint = spacePoint;\n this._workPoint = Point3d.create();\n this._workRay = Ray3d.createZero();\n this._closestPoint = undefined;\n this._extend = extend;\n this.startCurvePrimitive(undefined);\n this._newtonSolver = new Newton1dUnboundedApproximateDerivative(this);\n }\n\n public claimResult(): CurveLocationDetail | undefined {\n if (this._closestPoint) {\n this._newtonSolver.setX(this._closestPoint.fraction);\n this._curve = this._closestPoint.curve;\n if (this._newtonSolver.runIterations()) {\n let fraction = this._newtonSolver.getX();\n fraction = CurveExtendOptions.correctFraction(this._extend, fraction);\n this.announceSolutionFraction(fraction);\n }\n }\n return this._closestPoint;\n }\n\n public needPrimaryGeometryForStrokes() {\n return true;\n }\n\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\n this._curve = curve;\n this._fractionA = 0.0;\n this._numThisCurve = 0;\n this._functionA = 0.0;\n }\n\n public endCurvePrimitive() {\n }\n\n public announceIntervalForUniformStepStrokes(cp: CurvePrimitive, numStrokes: number, fraction0: number, fraction1: number): void {\n this.startCurvePrimitive(cp);\n this.announceSolutionFraction(0.0); // test start point as closest\n this.announceSolutionFraction(1.0); // test end point as closest\n if (numStrokes < 1) numStrokes = 1;\n const df = 1.0 / numStrokes;\n for (let i = 0; i <= numStrokes; i++) {\n const fraction = Geometry.interpolate(fraction0, i * df, fraction1);\n cp.fractionToPointAndDerivative(fraction, this._workRay);\n this.announceRay(fraction, this._workRay);\n }\n }\n\n private announceCandidate(cp: CurvePrimitive, fraction: number, point: Point3d) {\n const distance = this._spacePoint.distance(point);\n if (this._closestPoint && distance > this._closestPoint.a)\n return;\n this._closestPoint = CurveLocationDetail.createCurveFractionPoint(cp, fraction, point, this._closestPoint);\n this._closestPoint.a = distance;\n if (this._parentCurvePrimitive !== undefined)\n this._closestPoint.curve = this._parentCurvePrimitive;\n }\n\n public announceSegmentInterval(cp: CurvePrimitive, point0: Point3d, point1: Point3d, _numStrokes: number, fraction0: number, fraction1: number): void {\n let localFraction = this._spacePoint.fractionOfProjectionToLine(point0, point1, 0.0);\n // only consider extending the segment if the immediate caller says we are at endpoints ...\n if (!this._extend)\n localFraction = Geometry.clampToStartEnd(localFraction, 0.0, 1.0);\n else {\n if (fraction0 !== 0.0)\n localFraction = Math.max(localFraction, 0.0);\n if (fraction1 !== 1.0)\n localFraction = Math.min(localFraction, 1.0);\n }\n this._workPoint = point0.interpolate(localFraction, point1);\n const globalFraction = Geometry.interpolate(fraction0, localFraction, fraction1);\n this.announceCandidate(cp, globalFraction, this._workPoint);\n }\n\n private searchInterval() {\n if (this._functionA * this._functionB > 0) return;\n if (this._functionA === 0) this.announceSolutionFraction(this._fractionA);\n if (this._functionB === 0) this.announceSolutionFraction(this._fractionB);\n if (this._functionA * this._functionB < 0) {\n const fraction = Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);\n if (fraction) {\n this._newtonSolver.setX(fraction);\n if (this._newtonSolver.runIterations())\n this.announceSolutionFraction(this._newtonSolver.getX());\n }\n }\n }\n\n private evaluateB(fractionB: number, dataB: Ray3d) {\n this._functionB = dataB.dotProductToPoint(this._spacePoint);\n this._fractionB = fractionB;\n }\n\n private announceSolutionFraction(fraction: number) {\n if (this._curve)\n this.announceCandidate(this._curve, fraction, this._curve.fractionToPoint(fraction));\n }\n\n public evaluate(fraction: number): boolean {\n let curve = this._curve;\n if (this._parentCurvePrimitive)\n curve = this._parentCurvePrimitive;\n if (curve) {\n this._workRay = curve.fractionToPointAndDerivative(fraction, this._workRay);\n this.currentF = this._workRay.dotProductToPoint(this._spacePoint);\n return true;\n }\n return false;\n }\n\n public announceRay(fraction: number, data: Ray3d): void {\n this.evaluateB(fraction, data);\n if (this._numThisCurve++ > 0) this.searchInterval();\n this._functionA = this._functionB;\n this._fractionA = this._fractionB;\n }\n\n public announcePointTangent(point: Point3d, fraction: number, tangent: Vector3d) {\n this._workRay.set(point, tangent);\n this.announceRay(fraction, this._workRay);\n }\n}\n"]}
1
+ {"version":3,"file":"ClosestPointStrokeHandler.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/ClosestPointStrokeHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6CAA0C;AAE1C,sEAAqE;AACrE,kDAA+C;AAC/C,kDAA+E;AAC/E,wDAAqF;AACrF,gEAA6D;AAE7D,uEAAoE;AAEpE;;;GAGG;AACH,MAAa,yBAA0B,S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C,CAAC;YAC5E,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAClE,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAEM,WAAW,CAAC,QAAgB,EAAE,IAAW;QAC9C,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC/B,IAAI,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC;YAAE,IAAI,CAAC,cAAc,EAAE,CAAC;QACpD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;IACpC,CAAC;IAEM,oBAAoB,CAAC,KAAc,EAAE,QAAgB,EAAE,OAAiB;QAC7E,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAClC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;CACF;AA3ID,8DA2IC","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/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Newton1dUnboundedApproximateDerivative } from \"../../numerics/Newton\";\r\nimport { CurveExtendOptions, VariantCurveExtendParameter } from \"../CurveExtendMode\";\r\nimport { CurveLocationDetail } from \"../CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { NewtonRtoRStrokeHandler } from \"./NewtonRtoRStrokeHandler\";\r\n\r\n/**\r\n * Context for searching for the closest point to a CurvePrimitive.\r\n * @internal\r\n */\r\nexport class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler implements IStrokeHandler {\r\n private _curve: CurvePrimitive | undefined;\r\n private _closestPoint: CurveLocationDetail | undefined;\r\n private _spacePoint: Point3d;\r\n private _extend: VariantCurveExtendParameter;\r\n private _fractionA: number = 0;\r\n private _functionA: number = 0;\r\n private _functionB: number = 0;\r\n private _fractionB: number = 0;\r\n private _numThisCurve: number = 0;\r\n // scratch vars for use within methods.\r\n private _workPoint: Point3d;\r\n private _workRay: Ray3d;\r\n private _newtonSolver: Newton1dUnboundedApproximateDerivative;\r\n\r\n public constructor(spacePoint: Point3d, extend: VariantCurveExtendParameter) {\r\n super();\r\n this._spacePoint = spacePoint;\r\n this._workPoint = Point3d.create();\r\n this._workRay = Ray3d.createZero();\r\n this._closestPoint = undefined;\r\n this._extend = extend;\r\n this.startCurvePrimitive(undefined);\r\n this._newtonSolver = new Newton1dUnboundedApproximateDerivative(this);\r\n }\r\n\r\n public claimResult(): CurveLocationDetail | undefined {\r\n if (this._closestPoint) {\r\n this._newtonSolver.setX(this._closestPoint.fraction);\r\n this._curve = this._closestPoint.curve;\r\n if (this._newtonSolver.runIterations()) {\r\n let fraction = this._newtonSolver.getX();\r\n fraction = CurveExtendOptions.correctFraction(this._extend, fraction);\r\n this.announceSolutionFraction(fraction);\r\n }\r\n }\r\n return this._closestPoint;\r\n }\r\n\r\n public needPrimaryGeometryForStrokes() {\r\n return true;\r\n }\r\n\r\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\r\n this._curve = curve;\r\n this._fractionA = 0.0;\r\n this._numThisCurve = 0;\r\n this._functionA = 0.0;\r\n }\r\n\r\n public endCurvePrimitive() {\r\n }\r\n\r\n public announceIntervalForUniformStepStrokes(cp: CurvePrimitive, numStrokes: number, fraction0: number, fraction1: number): void {\r\n this.startCurvePrimitive(cp);\r\n this.announceSolutionFraction(0.0); // test start point as closest\r\n this.announceSolutionFraction(1.0); // test end point as closest\r\n if (numStrokes < 1) numStrokes = 1;\r\n const df = 1.0 / numStrokes;\r\n for (let i = 0; i <= numStrokes; i++) {\r\n const fraction = Geometry.interpolate(fraction0, i * df, fraction1);\r\n cp.fractionToPointAndDerivative(fraction, this._workRay);\r\n this.announceRay(fraction, this._workRay);\r\n }\r\n }\r\n\r\n private announceCandidate(cp: CurvePrimitive, fraction: number, point: Point3d) {\r\n const distance = this._spacePoint.distance(point);\r\n if (this._closestPoint && distance > this._closestPoint.a)\r\n return;\r\n this._closestPoint = CurveLocationDetail.createCurveFractionPoint(cp, fraction, point, this._closestPoint);\r\n this._closestPoint.a = distance;\r\n if (this._parentCurvePrimitive !== undefined)\r\n this._closestPoint.curve = this._parentCurvePrimitive;\r\n }\r\n\r\n public announceSegmentInterval(cp: CurvePrimitive, point0: Point3d, point1: Point3d, _numStrokes: number, fraction0: number, fraction1: number): void {\r\n let localFraction = this._spacePoint.fractionOfProjectionToLine(point0, point1, 0.0);\r\n // only consider extending the segment if the immediate caller says we are at endpoints ...\r\n if (!this._extend)\r\n localFraction = Geometry.clampToStartEnd(localFraction, 0.0, 1.0);\r\n else {\r\n if (fraction0 !== 0.0)\r\n localFraction = Math.max(localFraction, 0.0);\r\n if (fraction1 !== 1.0)\r\n localFraction = Math.min(localFraction, 1.0);\r\n }\r\n this._workPoint = point0.interpolate(localFraction, point1);\r\n const globalFraction = Geometry.interpolate(fraction0, localFraction, fraction1);\r\n this.announceCandidate(cp, globalFraction, this._workPoint);\r\n }\r\n\r\n private searchInterval() {\r\n if (this._functionA * this._functionB > 0) return;\r\n if (this._functionA === 0) this.announceSolutionFraction(this._fractionA);\r\n if (this._functionB === 0) this.announceSolutionFraction(this._fractionB);\r\n if (this._functionA * this._functionB < 0) {\r\n const fraction = Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);\r\n if (fraction) {\r\n this._newtonSolver.setX(fraction);\r\n if (this._newtonSolver.runIterations())\r\n this.announceSolutionFraction(this._newtonSolver.getX());\r\n }\r\n }\r\n }\r\n\r\n private evaluateB(fractionB: number, dataB: Ray3d) {\r\n this._functionB = dataB.dotProductToPoint(this._spacePoint);\r\n this._fractionB = fractionB;\r\n }\r\n\r\n private announceSolutionFraction(fraction: number) {\r\n if (this._curve)\r\n this.announceCandidate(this._curve, fraction, this._curve.fractionToPoint(fraction));\r\n }\r\n\r\n public evaluate(fraction: number): boolean {\r\n let curve = this._curve;\r\n if (this._parentCurvePrimitive)\r\n curve = this._parentCurvePrimitive;\r\n if (curve) {\r\n this._workRay = curve.fractionToPointAndDerivative(fraction, this._workRay);\r\n this.currentF = this._workRay.dotProductToPoint(this._spacePoint);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n public announceRay(fraction: number, data: Ray3d): void {\r\n this.evaluateB(fraction, data);\r\n if (this._numThisCurve++ > 0) this.searchInterval();\r\n this._functionA = this._functionB;\r\n this._fractionA = this._fractionB;\r\n }\r\n\r\n public announcePointTangent(point: Point3d, fraction: number, tangent: Vector3d) {\r\n this._workRay.set(point, tangent);\r\n this.announceRay(fraction, this._workRay);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"CountLinearPartsSearchContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/CountLinearPartsSearchContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAO/F,sDAAqE;AACrE,oDAAiD;AACjD,kDAA+C;AAE/C;;GAEG;AACH,MAAa,6BAA8B,SAAQ,iDAAgC;IAIjF;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC;QACxB,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;IACpB,CAAC;IACM,MAAM,CAAC,sBAAsB,CAAC,MAAuB;QAC1D,MAAM,OAAO,GAAG,IAAI,6BAA6B,EAAE,CAAC;QACpD,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;QACzC,OAAO,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IAC9B,CAAC;IACe,sBAAsB,CAAC,KAAqB,EAAE,cAAsB;QAClF,IAAI,KAAK,YAAY,6BAAa;YAChC,IAAI,CAAC,cAAc,EAAE,CAAC;aACnB,IAAI,KAAK,YAAY,2BAAY;YACpC,IAAI,CAAC,aAAa,EAAE,CAAC;;YAErB,IAAI,CAAC,QAAQ,EAAE,CAAC;IACpB,CAAC;CACF;AAvBD,sEAuBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Curve\n */\nimport { CurveCollection } from \"../CurveCollection\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\nimport { RecursiveCurveProcessorWithStack } from \"../CurveProcessor\";\nimport { LineSegment3d } from \"../LineSegment3d\";\nimport { LineString3d } from \"../LineString3d\";\n\n/** Algorithmic class: Count LineSegment3d and LineString3d primitives.\n * @internal\n */\nexport class CountLinearPartsSearchContext extends RecursiveCurveProcessorWithStack {\n public numLineSegment: number;\n public numLineString: number;\n public numOther: number;\n constructor() {\n super();\n this.numLineSegment = 0;\n this.numLineString = 0;\n this.numOther = 0;\n }\n public static hasNonLinearPrimitives(target: CurveCollection): boolean {\n const context = new CountLinearPartsSearchContext();\n target.announceToCurveProcessor(context);\n return context.numOther > 0;\n }\n public override announceCurvePrimitive(curve: CurvePrimitive, _indexInParent: number): void {\n if (curve instanceof LineSegment3d)\n this.numLineSegment++;\n else if (curve instanceof LineString3d)\n this.numLineString++;\n else\n this.numOther++;\n }\n}\n"]}
1
+ {"version":3,"file":"CountLinearPartsSearchContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/CountLinearPartsSearchContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAO/F,sDAAqE;AACrE,oDAAiD;AACjD,kDAA+C;AAE/C;;GAEG;AACH,MAAa,6BAA8B,SAAQ,iDAAgC;IAIjF;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC;QACxB,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;IACpB,CAAC;IACM,MAAM,CAAC,sBAAsB,CAAC,MAAuB;QAC1D,MAAM,OAAO,GAAG,IAAI,6BAA6B,EAAE,CAAC;QACpD,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;QACzC,OAAO,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IAC9B,CAAC;IACe,sBAAsB,CAAC,KAAqB,EAAE,cAAsB;QAClF,IAAI,KAAK,YAAY,6BAAa;YAChC,IAAI,CAAC,cAAc,EAAE,CAAC;aACnB,IAAI,KAAK,YAAY,2BAAY;YACpC,IAAI,CAAC,aAAa,EAAE,CAAC;;YAErB,IAAI,CAAC,QAAQ,EAAE,CAAC;IACpB,CAAC;CACF;AAvBD,sEAuBC","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 { CurveCollection } from \"../CurveCollection\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { RecursiveCurveProcessorWithStack } from \"../CurveProcessor\";\r\nimport { LineSegment3d } from \"../LineSegment3d\";\r\nimport { LineString3d } from \"../LineString3d\";\r\n\r\n/** Algorithmic class: Count LineSegment3d and LineString3d primitives.\r\n * @internal\r\n */\r\nexport class CountLinearPartsSearchContext extends RecursiveCurveProcessorWithStack {\r\n public numLineSegment: number;\r\n public numLineString: number;\r\n public numOther: number;\r\n constructor() {\r\n super();\r\n this.numLineSegment = 0;\r\n this.numLineString = 0;\r\n this.numOther = 0;\r\n }\r\n public static hasNonLinearPrimitives(target: CurveCollection): boolean {\r\n const context = new CountLinearPartsSearchContext();\r\n target.announceToCurveProcessor(context);\r\n return context.numOther > 0;\r\n }\r\n public override announceCurvePrimitive(curve: CurvePrimitive, _indexInParent: number): void {\r\n if (curve instanceof LineSegment3d)\r\n this.numLineSegment++;\r\n else if (curve instanceof LineString3d)\r\n this.numLineString++;\r\n else\r\n this.numOther++;\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"CurveLengthContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/CurveLengthContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAIH,kDAAiD;AACjD,kDAA+C;AAC/C,0DAAwD;AAGxD;;;GAGG;AACH,MAAa,kBAAkB;IAQrB,gBAAgB,CAAC,QAAgB;QACvC,IAAI,CAAC,IAAI,GAAI,IAAI,CAAC,MAAyB,CAAC,4BAA4B,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9F,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC;IACzC,CAAC;IAED,2DAA2D;IAC3D,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,2DAA2D;IAC3D,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAEM,MAAM;QACX,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,YAAmB,YAAoB,GAAG,EAAE,YAAoB,GAAG,EAAE,iBAAyB,CAAC;QAC7F,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;QACpC,IAAI,CAAC,aAAa,GAAG,GAAG,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,aAAK,CAAC,UAAU,EAAE,CA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,eAAe,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;gBAChF,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;gBAClE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,EAAE,CAAC,EAAE,EAAE;oBACjC,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;iBACxG;aACF;SACF;IACH,CAAC;IAEM,uBAAuB,CAAC,GAAmB,EAAE,MAAe,EAAE,MAAe,EAAE,WAAmB,EAAE,SAAiB,EAAE,SAAiB;QAC7I,MAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC9C,IAAI,IAAI,CAAC,UAAU,IAAI,SAAS,IAAI,SAAS,IAAI,IAAI,CAAC,UAAU;YAC9D,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC;aACjC;YACH,MAAM,KAAK,GAAG,eAAO,CAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;YACrD,KAAK,CAAC,uBAAuB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;YAChE,IAAI,CAAC,KAAK,CAAC,MAAM;gBACf,IAAI,CAAC,aAAa,IAAI,aAAa,GAAG,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;SAClF;IACH,CAAC;IAEM,oBAAoB,CAAC,IAAa,EAAE,SAAiB,EAAE,QAAkB;QAC9E,kDAAkD;IACpD,CAAC;CACF;AAxFD,gDAwFC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Curve\n */\n\nimport { IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\nimport { Range1d } from \"../../geometry3d/Range\";\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\nimport { GaussMapper } from \"../../numerics/Quadrature\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\n\n/**\n * Context for computing the length of a CurvePrimitive.\n * @internal\n */\nexport class CurveLengthContext implements IStrokeHandler {\n private _curve: CurvePrimitive | undefined;\n private _summedLength: number;\n private _ray: Ray3d;\n private _fraction0: number;\n private _fraction1: number;\n private _gaussMapper: GaussMapper;\n\n private tangentMagnitude(fraction: number): number {\n this._ray = (this._curve as CurvePrimitive).fractionToPointAndDerivative(fraction, this._ray);\n return this._ray.direction.magnitude();\n }\n\n /** Return the fraction0 installed at construction time. */\n public get getFraction0(): number {\n return this._fraction0;\n }\n\n /** Return the fraction1 installed at construction time. */\n public get getFraction1(): number {\n return this._fraction1;\n }\n\n public getSum() {\n return this._summedLength;\n }\n\n public constructor(fraction0: number = 0.0, fraction1: number = 1.0, numGaussPoints: number = 5) {\n this.startCurvePrimitive(undefined);\n this._summedLength = 0.0;\n this._ray = Ray3d.createZero();\n if (fraction0 < fraction1) {\n this._fraction0 = fraction0;\n this._fraction1 = fraction1;\n } else {\n this._fraction0 = fraction1;\n this._fraction1 = fraction0;\n }\n this._gaussMapper = new GaussMapper(numGaussPoints);\n }\n\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\n this._curve = curve;\n }\n\n public startParentCurvePrimitive(_curve: CurvePrimitive) {\n }\n\n public endParentCurvePrimitive(_curve: CurvePrimitive) {\n }\n\n public endCurvePrimitive() {\n }\n\n public announceIntervalForUniformStepStrokes(cp: CurvePrimitive, numStrokes: number, fraction0: number, fraction1: number): void {\n const range = Range1d.createXX(fraction0, fraction1);\n range.intersectRangeXXInPlace(this._fraction0, this._fraction1);\n if (!range.isNull) {\n this.startCurvePrimitive(cp);\n if (numStrokes < 1)\n numStrokes = 1;\n const df = 1.0 / numStrokes;\n for (let i = 1; i <= numStrokes; i++) {\n const fractionA = range.fractionToPoint((i - 1) * df);\n const fractionB = i === numStrokes ? range.high : range.fractionToPoint(i * df);\n const numGauss = this._gaussMapper.mapXAndW(fractionA, fractionB);\n for (let k = 0; k < numGauss; k++) {\n this._summedLength += this._gaussMapper.gaussW[k] * this.tangentMagnitude(this._gaussMapper.gaussX[k]);\n }\n }\n }\n }\n\n public announceSegmentInterval(_cp: CurvePrimitive, point0: Point3d, point1: Point3d, _numStrokes: number, fraction0: number, fraction1: number): void {\n const segmentLength = point0.distance(point1);\n if (this._fraction0 <= fraction0 && fraction1 <= this._fraction1)\n this._summedLength += segmentLength;\n else {\n const range = Range1d.createXX(fraction0, fraction1);\n range.intersectRangeXXInPlace(this._fraction0, this._fraction1);\n if (!range.isNull)\n this._summedLength += segmentLength * range.length() / (fraction1 - fraction0);\n }\n }\n\n public announcePointTangent(_xyz: Point3d, _fraction: number, _tangent: Vector3d): void {\n // uh oh -- need to retain point for next interval\n }\n}\n"]}
1
+ {"version":3,"file":"CurveLengthContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/CurveLengthContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAIH,kDAAiD;AACjD,kDAA+C;AAC/C,0DAAwD;AAGxD;;;GAGG;AACH,MAAa,kBAAkB;IAQrB,gBAAgB,CAAC,QAAgB;QACvC,IAAI,CAAC,IAAI,GAAI,IAAI,CAAC,MAAyB,CAAC,4BAA4B,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9F,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC;IACzC,CAAC;IAED,2DAA2D;IAC3D,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAA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AC;YAChE,IAAI,CAAC,KAAK,CAAC,MAAM;gBACf,IAAI,CAAC,aAAa,IAAI,aAAa,GAAG,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;SAClF;IACH,CAAC;IAEM,oBAAoB,CAAC,IAAa,EAAE,SAAiB,EAAE,QAAkB;QAC9E,kDAAkD;IACpD,CAAC;CACF;AAxFD,gDAwFC","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/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Range1d } from \"../../geometry3d/Range\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { GaussMapper } from \"../../numerics/Quadrature\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\n\r\n/**\r\n * Context for computing the length of a CurvePrimitive.\r\n * @internal\r\n */\r\nexport class CurveLengthContext implements IStrokeHandler {\r\n private _curve: CurvePrimitive | undefined;\r\n private _summedLength: number;\r\n private _ray: Ray3d;\r\n private _fraction0: number;\r\n private _fraction1: number;\r\n private _gaussMapper: GaussMapper;\r\n\r\n private tangentMagnitude(fraction: number): number {\r\n this._ray = (this._curve as CurvePrimitive).fractionToPointAndDerivative(fraction, this._ray);\r\n return this._ray.direction.magnitude();\r\n }\r\n\r\n /** Return the fraction0 installed at construction time. */\r\n public get getFraction0(): number {\r\n return this._fraction0;\r\n }\r\n\r\n /** Return the fraction1 installed at construction time. */\r\n public get getFraction1(): number {\r\n return this._fraction1;\r\n }\r\n\r\n public getSum() {\r\n return this._summedLength;\r\n }\r\n\r\n public constructor(fraction0: number = 0.0, fraction1: number = 1.0, numGaussPoints: number = 5) {\r\n this.startCurvePrimitive(undefined);\r\n this._summedLength = 0.0;\r\n this._ray = Ray3d.createZero();\r\n if (fraction0 < fraction1) {\r\n this._fraction0 = fraction0;\r\n this._fraction1 = fraction1;\r\n } else {\r\n this._fraction0 = fraction1;\r\n this._fraction1 = fraction0;\r\n }\r\n this._gaussMapper = new GaussMapper(numGaussPoints);\r\n }\r\n\r\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\r\n this._curve = curve;\r\n }\r\n\r\n public startParentCurvePrimitive(_curve: CurvePrimitive) {\r\n }\r\n\r\n public endParentCurvePrimitive(_curve: CurvePrimitive) {\r\n }\r\n\r\n public endCurvePrimitive() {\r\n }\r\n\r\n public announceIntervalForUniformStepStrokes(cp: CurvePrimitive, numStrokes: number, fraction0: number, fraction1: number): void {\r\n const range = Range1d.createXX(fraction0, fraction1);\r\n range.intersectRangeXXInPlace(this._fraction0, this._fraction1);\r\n if (!range.isNull) {\r\n this.startCurvePrimitive(cp);\r\n if (numStrokes < 1)\r\n numStrokes = 1;\r\n const df = 1.0 / numStrokes;\r\n for (let i = 1; i <= numStrokes; i++) {\r\n const fractionA = range.fractionToPoint((i - 1) * df);\r\n const fractionB = i === numStrokes ? range.high : range.fractionToPoint(i * df);\r\n const numGauss = this._gaussMapper.mapXAndW(fractionA, fractionB);\r\n for (let k = 0; k < numGauss; k++) {\r\n this._summedLength += this._gaussMapper.gaussW[k] * this.tangentMagnitude(this._gaussMapper.gaussX[k]);\r\n }\r\n }\r\n }\r\n }\r\n\r\n public announceSegmentInterval(_cp: CurvePrimitive, point0: Point3d, point1: Point3d, _numStrokes: number, fraction0: number, fraction1: number): void {\r\n const segmentLength = point0.distance(point1);\r\n if (this._fraction0 <= fraction0 && fraction1 <= this._fraction1)\r\n this._summedLength += segmentLength;\r\n else {\r\n const range = Range1d.createXX(fraction0, fraction1);\r\n range.intersectRangeXXInPlace(this._fraction0, this._fraction1);\r\n if (!range.isNull)\r\n this._summedLength += segmentLength * range.length() / (fraction1 - fraction0);\r\n }\r\n }\r\n\r\n public announcePointTangent(_xyz: Point3d, _fraction: number, _tangent: Vector3d): void {\r\n // uh oh -- need to retain point for next interval\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"CurveOffsetXYHandler.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/CurveOffsetXYHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6CAA0C;AAC1C,sEAAqE;AACrE,kDAA+C;AAI/C,6EAAiF;AACjF,mEAAgE;AAEhE;;;GAGG;AACF,MAAa,oBAAoB;IAWhC,YAAmB,EAAkB,EAAE,cAAsB;QAP7D,sBAAsB;QACd,QAAG,GAAG,yBAAO,CAAC,UAAU,EAAE,CAAC;QAC3B,QAAG,GAAG,yBAAO,CAAC,UAAU,EAAE,CAAC;QAC3B,QAAG,GAAG,0BAAQ,CAAC,UAAU,EAAE,CAAC;QAC5B,QAAG,GAAG,0BAAQ,CAAC,UAAU,EAAE,CAAC;QAC5B,QAAG,GAAG,aAAK,CAAC,UAAU,EAAE,CAAC;QAG/B,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QACtC,IAAI,CAAC,WAAW,GAAG,IAAI,kDAA2B,EAAE,CAAC;QACrD,MAAM,YAAY,GAAG,EAAE,CAAC,6BAA6B,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QACvF,MAAM,UAAU,GAAG,EAAE,CAAC,6BAA6B,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAE,oBAAoB;QAC5G,IAAI,CAAC,WAAW,CAAC,YAAY,GAAG,YAAY,CAAC;QAC7C,IAAI,CAAC,WAAW,CAAC,UAAU,GAAG,UAAU,CAAC;QACzC,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAA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SACjD;IACH,CAAC;IACM,uBAAuB,CAAC,GAAmB,EAAE,MAAe,EAAE,MAAe,EAAE,UAAkB,EAAE,UAAkB,EAAE,UAAkB;QAC9I,IAAI,UAAU,GAAG,CAAC,EAAE;YAClB,MAAM,OAAO,GAAG,0BAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;YAClE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,UAAU,EAAE,EAAE,CAAC,EAAE,EAAE,0FAA0F;gBAChI,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;aACrF;SACF;IACH,CAAC;IACM,oBAAoB,CAAC,GAAY,EAAE,SAAiB,EAAE,OAAiB;QAC5E,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACrC,CAAC;IACD;;;OAGG;IACI,WAAW;QAChB,OAAO,iCAAe,CAAC,0BAA0B,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACtE,CAAC;CACF;AAvDA,oDAuDA","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Curve\n */\n\nimport { Geometry } from \"../../Geometry\";\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\nimport { IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\nimport { BSplineCurve3d } from \"../../bspline/BSplineCurve\";\nimport { InterpolationCurve3dOptions } from \"../../bspline/InterpolationCurve3d\";\nimport { BSplineCurveOps } from \"../../bspline/BSplineCurveOps\";\n\n/**\n * Context for constructing the xy-offset of a CurvePrimitive by interpolating the xy-offsets of computed strokes.\n * @internal\n */\n export class CurveOffsetXYHandler implements IStrokeHandler {\n private _offsetDistance: number;\n private _fitOptions: InterpolationCurve3dOptions;\n\n // temporary workspace\n private _p0 = Point3d.createZero();\n private _p1 = Point3d.createZero();\n private _v0 = Vector3d.createZero();\n private _v1 = Vector3d.createZero();\n private _r0 = Ray3d.createZero();\n\n public constructor(cp: CurvePrimitive, offsetDistance: number) {\n this._offsetDistance = offsetDistance;\n this._fitOptions = new InterpolationCurve3dOptions();\n const startTangent = cp.fractionToPointAndUnitTangent(0.0, this._r0).direction.clone();\n const endTangent = cp.fractionToPointAndUnitTangent(1.0, this._r0).direction.negate(); // points into curve\n this._fitOptions.startTangent = startTangent;\n this._fitOptions.endTangent = endTangent;\n if (this._fitOptions.closed = (cp.startPoint(this._p0).isAlmostEqual(cp.endPoint(this._p1)) && startTangent.isParallelTo(endTangent, true)))\n this._fitOptions.isChordLenKnots = 1;\n }\n private pushOffsetPoint(xyz: Point3d, tangent: Vector3d) {\n if (!Geometry.isSmallMetricDistance(tangent.x) || !Geometry.isSmallMetricDistance(tangent.y))\n this._fitOptions.fitPoints.push(xyz.plusScaled(tangent.unitPerpendicularXY(this._v0), this._offsetDistance));\n }\n public needPrimaryGeometryForStrokes() { return true; }\n public startParentCurvePrimitive(_cp: CurvePrimitive) { }\n public startCurvePrimitive(_cp: CurvePrimitive) { }\n public endCurvePrimitive(_cp: CurvePrimitive) { }\n public endParentCurvePrimitive(_cp: CurvePrimitive) { }\n public announceIntervalForUniformStepStrokes(cp: CurvePrimitive, numStrokes: number, fraction0: number, fraction1: number): void {\n for (let i = 0; i <= numStrokes; ++i) { // announce both start and end; adjacent duplicates will be filtered by c2 cubic fit logic\n const fraction = Geometry.interpolate(fraction0, i / numStrokes, fraction1);\n const ray = cp.fractionToPointAndDerivative(fraction, this._r0);\n this.pushOffsetPoint(ray.origin, ray.direction);\n }\n }\n public announceSegmentInterval(_cp: CurvePrimitive, point0: Point3d, point1: Point3d, numStrokes: number, _fraction0: number, _fraction1: number): void {\n if (numStrokes > 0) {\n const tangent = Vector3d.createStartEnd(point0, point1, this._v1);\n for (let i = 0; i <= numStrokes; ++i) { // announce both start and end; adjacent duplicates will be filtered by c2 cubic fit logic\n this.pushOffsetPoint(point0.interpolate(i / numStrokes, point1, this._p0), tangent);\n }\n }\n }\n public announcePointTangent(xyz: Point3d, _fraction: number, tangent: Vector3d): void {\n this.pushOffsetPoint(xyz, tangent);\n }\n /**\n * Construct a C2 cubic interpolating B-spline curve through the collected xy-offset points.\n * @returns the xy-offset curve\n */\n public claimResult(): BSplineCurve3d | undefined {\n return BSplineCurveOps.createThroughPointsC2Cubic(this._fitOptions);\n }\n}\n"]}
1
+ {"version":3,"file":"CurveOffsetXYHandler.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/CurveOffsetXYHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6CAA0C;AAC1C,sEAAqE;AACrE,kDAA+C;AAI/C,6EAAiF;AACjF,mEAAgE;AAEhE;;;GAGG;AACF,MAAa,oBAAoB;IAWhC,YAAmB,EAAkB,EAAE,cAAsB;QAP7D,sBAAsB;QACd,QAAG,GAAG,yBAAO,CAAC,UAAU,EAAE,CAAC;QAC3B,QAAG,GAAG,yBAAO,CAAC,UAAU,EAAE,CAAC;QAC3B,QAAG,GAAG,0BAAQ,CAAC,UAAU,EAAE,CAAC;QAC5B,QAAG,GAAG,0BAAQ,CAAC,UAAU,EAAE,CAAC;QAC5B,QAAG,GAAG,aAAK,CAAC,UAAU,EAAE,CAAC;QAG/B,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QACtC,IAAI,CAAC,WAAW,GAAG,IAAI,kDAA2B,EAAE,CAAC;QACrD,MAAM,YAAY,GAAG,EAAE,CAAC,6BAA6B,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,KAA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C,EAAE,CAAC,IAAI,UAAU,EAAE,EAAE,CAAC,EAAE,EAAE,0FAA0F;YAChI,MAAM,QAAQ,GAAG,mBAAQ,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC,GAAG,UAAU,EAAE,SAAS,CAAC,CAAC;YAC5E,MAAM,GAAG,GAAG,EAAE,CAAC,4BAA4B,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;YAChE,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;SACjD;IACH,CAAC;IACM,uBAAuB,CAAC,GAAmB,EAAE,MAAe,EAAE,MAAe,EAAE,UAAkB,EAAE,UAAkB,EAAE,UAAkB;QAC9I,IAAI,UAAU,GAAG,CAAC,EAAE;YAClB,MAAM,OAAO,GAAG,0BAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;YAClE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,UAAU,EAAE,EAAE,CAAC,EAAE,EAAE,0FAA0F;gBAChI,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;aACrF;SACF;IACH,CAAC;IACM,oBAAoB,CAAC,GAAY,EAAE,SAAiB,EAAE,OAAiB;QAC5E,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACrC,CAAC;IACD;;;OAGG;IACI,WAAW;QAChB,OAAO,iCAAe,CAAC,0BAA0B,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACtE,CAAC;CACF;AAvDA,oDAuDA","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/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { BSplineCurve3d } from \"../../bspline/BSplineCurve\";\r\nimport { InterpolationCurve3dOptions } from \"../../bspline/InterpolationCurve3d\";\r\nimport { BSplineCurveOps } from \"../../bspline/BSplineCurveOps\";\r\n\r\n/**\r\n * Context for constructing the xy-offset of a CurvePrimitive by interpolating the xy-offsets of computed strokes.\r\n * @internal\r\n */\r\n export class CurveOffsetXYHandler implements IStrokeHandler {\r\n private _offsetDistance: number;\r\n private _fitOptions: InterpolationCurve3dOptions;\r\n\r\n // temporary workspace\r\n private _p0 = Point3d.createZero();\r\n private _p1 = Point3d.createZero();\r\n private _v0 = Vector3d.createZero();\r\n private _v1 = Vector3d.createZero();\r\n private _r0 = Ray3d.createZero();\r\n\r\n public constructor(cp: CurvePrimitive, offsetDistance: number) {\r\n this._offsetDistance = offsetDistance;\r\n this._fitOptions = new InterpolationCurve3dOptions();\r\n const startTangent = cp.fractionToPointAndUnitTangent(0.0, this._r0).direction.clone();\r\n const endTangent = cp.fractionToPointAndUnitTangent(1.0, this._r0).direction.negate(); // points into curve\r\n this._fitOptions.startTangent = startTangent;\r\n this._fitOptions.endTangent = endTangent;\r\n if (this._fitOptions.closed = (cp.startPoint(this._p0).isAlmostEqual(cp.endPoint(this._p1)) && startTangent.isParallelTo(endTangent, true)))\r\n this._fitOptions.isChordLenKnots = 1;\r\n }\r\n private pushOffsetPoint(xyz: Point3d, tangent: Vector3d) {\r\n if (!Geometry.isSmallMetricDistance(tangent.x) || !Geometry.isSmallMetricDistance(tangent.y))\r\n this._fitOptions.fitPoints.push(xyz.plusScaled(tangent.unitPerpendicularXY(this._v0), this._offsetDistance));\r\n }\r\n public needPrimaryGeometryForStrokes() { return true; }\r\n public startParentCurvePrimitive(_cp: CurvePrimitive) { }\r\n public startCurvePrimitive(_cp: CurvePrimitive) { }\r\n public endCurvePrimitive(_cp: CurvePrimitive) { }\r\n public endParentCurvePrimitive(_cp: CurvePrimitive) { }\r\n public announceIntervalForUniformStepStrokes(cp: CurvePrimitive, numStrokes: number, fraction0: number, fraction1: number): void {\r\n for (let i = 0; i <= numStrokes; ++i) { // announce both start and end; adjacent duplicates will be filtered by c2 cubic fit logic\r\n const fraction = Geometry.interpolate(fraction0, i / numStrokes, fraction1);\r\n const ray = cp.fractionToPointAndDerivative(fraction, this._r0);\r\n this.pushOffsetPoint(ray.origin, ray.direction);\r\n }\r\n }\r\n public announceSegmentInterval(_cp: CurvePrimitive, point0: Point3d, point1: Point3d, numStrokes: number, _fraction0: number, _fraction1: number): void {\r\n if (numStrokes > 0) {\r\n const tangent = Vector3d.createStartEnd(point0, point1, this._v1);\r\n for (let i = 0; i <= numStrokes; ++i) { // announce both start and end; adjacent duplicates will be filtered by c2 cubic fit logic\r\n this.pushOffsetPoint(point0.interpolate(i / numStrokes, point1, this._p0), tangent);\r\n }\r\n }\r\n }\r\n public announcePointTangent(xyz: Point3d, _fraction: number, tangent: Vector3d): void {\r\n this.pushOffsetPoint(xyz, tangent);\r\n }\r\n /**\r\n * Construct a C2 cubic interpolating B-spline curve through the collected xy-offset points.\r\n * @returns the xy-offset curve\r\n */\r\n public claimResult(): BSplineCurve3d | undefined {\r\n return BSplineCurveOps.createThroughPointsC2Cubic(this._fitOptions);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"GapSearchContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/GapSearchContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,wDAAiE;AAEjE,sDAAqE;AAErE,qJAAqJ;AACrJ;;;GAGG;AACH,MAAa,gBAAiB,SAAQ,iDAAgC;IAEpE;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;IACpB,CAAC;IACM,MAAM,CAAC,MAAM,CAAC,MAAuB;QAC1C,MAAM,OAAO,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACvC,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;QACzC,OAAO,OAAO,CAAC,MAAM,CAAC;IACxB,CAAC;IACe,sBAAsB,CAAC,KAAqB,EAAE,cAAsB;QAClF,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACnD,IAAI,MAAM,YAAY,4BAAU,EAAE;gBAChC,MAAM,KAAK,GAAG,MAAM,CAAC;gBACrB,MAAM,SAAS,GAAG,KAAK,CAAC,oBAAoB,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC;gBACjE,IAAI,KAAK,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS,EAAE;oBAClD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;iBACxF;aACF;SACF;IACH,CAAC;CACF;AAvBD,4CAuBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Curve\n */\nimport { CurveChain, CurveCollection } from \"../CurveCollection\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\nimport { RecursiveCurveProcessorWithStack } from \"../CurveProcessor\";\n\n// import { SumLengthsContext, GapSearchContext, CountLinearPartsSearchContext, CloneCurvesContext, TransformInPlaceContext } from \"./CurveSearches\";\n/**\n * Algorithmic class: Accumulate maximum gap between adjacent primitives of CurveChain.\n * @internal\n */\nexport class GapSearchContext extends RecursiveCurveProcessorWithStack {\n public maxGap: number;\n constructor() {\n super();\n this.maxGap = 0.0;\n }\n public static maxGap(target: CurveCollection): number {\n const context = new GapSearchContext();\n target.announceToCurveProcessor(context);\n return context.maxGap;\n }\n public override announceCurvePrimitive(curve: CurvePrimitive, _indexInParent: number): void {\n if (this._stack.length > 0) {\n const parent = this._stack[this._stack.length - 1];\n if (parent instanceof CurveChain) {\n const chain = parent;\n const nextCurve = chain.cyclicCurvePrimitive(_indexInParent + 1);\n if (curve !== undefined && nextCurve !== undefined) {\n this.maxGap = Math.max(this.maxGap, curve.endPoint().distance(nextCurve.startPoint()));\n }\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"GapSearchContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/GapSearchContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,wDAAiE;AAEjE,sDAAqE;AAErE,qJAAqJ;AACrJ;;;GAGG;AACH,MAAa,gBAAiB,SAAQ,iDAAgC;IAEpE;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;IACpB,CAAC;IACM,MAAM,CAAC,MAAM,CAAC,MAAuB;QAC1C,MAAM,OAAO,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACvC,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;QACzC,OAAO,OAAO,CAAC,MAAM,CAAC;IACxB,CAAC;IACe,sBAAsB,CAAC,KAAqB,EAAE,cAAsB;QAClF,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACnD,IAAI,MAAM,YAAY,4BAAU,EAAE;gBAChC,MAAM,KAAK,GAAG,MAAM,CAAC;gBACrB,MAAM,SAAS,GAAG,KAAK,CAAC,oBAAoB,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC;gBACjE,IAAI,KAAK,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS,EAAE;oBAClD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;iBACxF;aACF;SACF;IACH,CAAC;CACF;AAvBD,4CAuBC","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 { CurveChain, CurveCollection } from \"../CurveCollection\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { RecursiveCurveProcessorWithStack } from \"../CurveProcessor\";\r\n\r\n// import { SumLengthsContext, GapSearchContext, CountLinearPartsSearchContext, CloneCurvesContext, TransformInPlaceContext } from \"./CurveSearches\";\r\n/**\r\n * Algorithmic class: Accumulate maximum gap between adjacent primitives of CurveChain.\r\n * @internal\r\n */\r\nexport class GapSearchContext extends RecursiveCurveProcessorWithStack {\r\n public maxGap: number;\r\n constructor() {\r\n super();\r\n this.maxGap = 0.0;\r\n }\r\n public static maxGap(target: CurveCollection): number {\r\n const context = new GapSearchContext();\r\n target.announceToCurveProcessor(context);\r\n return context.maxGap;\r\n }\r\n public override announceCurvePrimitive(curve: CurvePrimitive, _indexInParent: number): void {\r\n if (this._stack.length > 0) {\r\n const parent = this._stack[this._stack.length - 1];\r\n if (parent instanceof CurveChain) {\r\n const chain = parent;\r\n const nextCurve = chain.cyclicCurvePrimitive(_indexInParent + 1);\r\n if (curve !== undefined && nextCurve !== undefined) {\r\n this.maxGap = Math.max(this.maxGap, curve.endPoint().distance(nextCurve.startPoint()));\r\n }\r\n }\r\n }\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MultiChainCollector.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/MultiChainCollector.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,6CAA0C;AAC1C,gEAA6D;AAG7D,oCAAiC;AAEjC,wDAAkE;AAClE,8CAA2C;AAC3C,sDAAmD;AACnD,oDAAiD;AACjD,kDAA+C;AAC/C,kCAA+B;AAC/B,kCAA+B;AAC/B,4CAAqD;AAGrD;;;;;;;;;;;;;GAaG;AACH,MAAa,mBAAmB;IAe9B;;;OAGG;IACH,YAAmB,YAAY,GAAG,mBAAQ,CAAC,mBAAmB,EAAE,iBAAqC,mBAAQ,CAAC,mBAAmB;QAC/H,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAI,CAAC,cAAc,GAAG,mBAAQ,CAAC,mBAAmB,CAAC;QACnD,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;IACxC,CAAC;IACD;;;;;OAKG;IACK,qBAAqB,CAAC,GAAY,EAAE,SAAiB,EAAE,mBAA2B,CAAC,CAAC;QAC1F,KAAK,IAAI,WAAW,GAAG,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE;YAC1E,IAAI,gBAAgB,KAAK,WAAW;gBAClC,SAAS;YACX,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YACxC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAClE,IAAI,IAAI,CAAC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,CAAC;YACrB,OAAO,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC;QAChE,MAAM,GAAG,GAAG,6BAAW,CAAC,MAAM,EAAE,CAAC;QACjC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;YAC1B,MAAM,CAAC,GAAG,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;YAC7D,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;SACpB;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IACD,0DAA0D;IACnD,4BAA4B,CAAC,aAAyC,EAAE,OAAuB;QACpG,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YACvB,MAAM,EAAE,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;YACxD,IAAI,EAAE;gBACJ,aAAa,CAAC,EAAE,CAAC,CAAC;SACrB;aAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YAC5B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;gBAC1B,MAAM,EAAE,GAAG,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;gBACpD,IAAI,EAAE;oBACJ,aAAa,CAAC,EAAE,CAAC,CAAC;aACrB;SACF;IACH,CAAC;CACF;AApTD,kDAoTC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Curve\n */\n\nimport { Geometry } from \"../../Geometry\";\nimport { FrameBuilder } from \"../../geometry3d/FrameBuilder\";\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\nimport { XYAndZ } from \"../../geometry3d/XYZProps\";\nimport { Arc3d } from \"../Arc3d\";\nimport { AnyCurve } from \"../CurveChain\";\nimport { BagOfCurves, CurveCollection } from \"../CurveCollection\";\nimport { CurveCurve } from \"../CurveCurve\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\nimport { LineSegment3d } from \"../LineSegment3d\";\nimport { LineString3d } from \"../LineString3d\";\nimport { Loop } from \"../Loop\";\nimport { Path } from \"../Path\";\nimport { ChainTypes, RegionOps } from \"../RegionOps\";\nimport { StrokeOptions } from \"../StrokeOptions\";\n\n/**\n * Manage a growing array of arrays of curve primitives that are to be joined \"head to tail\" in paths.\n * * The caller makes a sequence of calls to announce individual primitives.\n * * This collector (unlike the simpler [[ChainCollectorContext]]) expects to have inputs arriving in random order, leaving multiple open chains in play at any time.\n * * When all curves have been announced, the call to `grabResults` restructures the various active chains into Paths (and optionally, Loops).\n * * Chain formation is dependent upon input fragment order, as a greedy algorithm is employed.\n * * Usage pattern is\n * * initialization: `context = new MultiChainCollector(gapTol, planeTol)`\n * * many times:\n * * `context.captureCurve(anyCurve)`\n * * `context.captureCurvePrimitive(primitive)`\n * * end: `result = context.grabResult(makeLoopIfClosed)`\n * @internal\n */\nexport class MultiChainCollector {\n /** accumulated chains */\n private _chains: CurvePrimitive[][];\n /** largest gap distance to close */\n private _gapTolerance: number;\n /** end point snap tolerance (assumed to be as tight or tighter than gapTolerance) */\n private _snapTolerance: number;\n /** tolerance for choosing Path or Loop. If undefined, always Path. */\n private _planeTolerance: number | undefined;\n\n private static _staticPointA: Point3d;\n private static _staticPointB: Point3d;\n private _xyzWork0?: Point3d;\n private _xyzWork1?: Point3d;\n\n /** Initialize with an empty array of chains.\n * @param gapTolerance tolerance for calling endpoints identical\n * @param planeTolerance tolerance for considering a closed chain to be planar. If undefined, only create Path. If defined, create Loops for closed chains within tolerance of a plane.\n */\n public constructor(gapTolerance = Geometry.smallMetricDistance, planeTolerance: number | undefined = Geometry.smallMetricDistance) {\n this._chains = [];\n this._gapTolerance = gapTolerance;\n this._snapTolerance = Geometry.smallMetricDistance;\n this._planeTolerance = planeTolerance;\n }\n /**\n * Find a chain (with index _other than_ exceptChainIndex) that starts or ends at xyz\n * @param xyz endpoint to check\n * @param tolerance absolute distance tolerance for equating endpoints\n * @param exceptChainIndex index of chain to ignore. Send -1 to consider all chains.\n */\n private findAnyChainToConnect(xyz: Point3d, tolerance: number, exceptChainIndex: number = -1): { chainIndex: number, atEnd: boolean } | undefined {\n for (let chainIndexA = 0; chainIndexA < this._chains.length; chainIndexA++) {\n if (exceptChainIndex === chainIndexA)\n continue;\n const chain = this._chains[chainIndexA];\n this._xyzWork1 = chain[chain.length - 1].endPoint(this._xyzWork1);\n if (this._xyzWork1.isAlmostEqual(xyz, tolerance))\n return { chainIndex: chainIndexA, atEnd: true };\n this._xyzWork1 = chain[0].startPoint(this._xyzWork1);\n if (this._xyzWork1.isAlmostEqual(xyz, tolerance))\n return { chainIndex: chainIndexA, atEnd: false };\n }\n return undefined;\n }\n /**\n * Insert a single curve primitive into the active chains.\n * * The primitive is captured (not cloned)\n * * The primitive may be reversed in place\n * @param candidate curve to add to the context\n */\n public captureCurvePrimitive(candidate: CurvePrimitive) {\n if (this._snapTolerance < this._gapTolerance) {\n if (this.attachPrimitiveToAnyChain(candidate, this._snapTolerance))\n return;\n }\n if (this.attachPrimitiveToAnyChain(candidate, this._gapTolerance))\n return;\n this._chains.push([candidate]);\n }\n /**\n * Insert any curve into the collection.\n * * This recurses into Path, Loop, BagOfCurves etc\n * * All primitives are captured, and may be reversed in place.\n * @param candidate curve to add to the context\n */\n public captureCurve(candidate: AnyCurve) {\n if (candidate instanceof CurvePrimitive)\n this.captureCurvePrimitive(candidate);\n else if (candidate instanceof CurveCollection && candidate.children !== undefined) {\n for (const c of candidate.children) {\n this.captureCurve(c as AnyCurve);\n }\n }\n }\n /** If allowed by the geometry type, move an endpoint. */\n private static simpleEndPointMove(curve: CurvePrimitive, atEnd: boolean, to: XYAndZ): boolean {\n if (curve instanceof (LineSegment3d)) {\n if (atEnd) {\n curve.point1Ref.setFrom(to);\n } else {\n curve.point0Ref.setFrom(to);\n }\n return true;\n } else if (curve instanceof LineString3d && curve.numPoints() > 0) {\n const i = atEnd ? curve.numPoints() - 1 : 0;\n curve.packedPoints.setAtCheckedPointIndex(i, to);\n return true;\n }\n return false;\n }\n /**\n * Try to move the end of curve0 and/or the start of curve1 to a common point.\n * * All z-coordinates are ignored.\n * @param curve0 first curve, assumed to end close to the start of curve1\n * @param curve1 second curve, assumed to start close to the end of curve0\n * @param gapTolerance max distance to move a curve start/end point\n * @returns whether curve start/end point(s) moved\n */\n private static moveHeadOrTail(curve0: CurvePrimitive, curve1: CurvePrimitive, gapTolerance: number): boolean {\n const xyz0 = curve0.endPoint();\n const xyz1 = curve1.startPoint();\n const minShift = Geometry.smallMetricDistance * 0.001;\n const d01 = xyz0.distanceXY(xyz1);\n if (d01 < minShift)\n return false;\n // try lines and linestrings\n if (d01 < gapTolerance) {\n if (this.simpleEndPointMove(curve1, false, xyz0) || this.simpleEndPointMove(curve0, true, xyz1))\n return true;\n }\n // try other primitive types\n const intersections = CurveCurve.intersectionXYPairs(curve0, true, curve1, true);\n const shiftFactor = 5.0;\n for (const pair of intersections) {\n const detail0 = pair.detailA;\n const detail1 = pair.detailB;\n const distance0 = detail0.point.distanceXY(xyz0);\n const distance1 = detail1.point.distanceXY(xyz1);\n if (distance0 < shiftFactor * gapTolerance && distance1 < shiftFactor * gapTolerance) {\n if (curve0 instanceof Arc3d && curve1 instanceof Arc3d) {\n const radians0End = curve0.sweep.fractionToRadians(detail0.fraction);\n curve0.sweep.setStartEndRadians(curve0.sweep.startRadians, radians0End);\n const radians1Start = curve1.sweep.fractionToRadians(detail1.fraction);\n curve1.sweep.setStartEndRadians(radians1Start, curve1.sweep.endRadians);\n return true;\n }\n // TODO: other combinations of types\n }\n }\n return false;\n }\n /** Announce a curve primitive\n * * If a \"nearby\" connection is possible, insert the candidate in the chain and force endpoint match.\n * * Otherwise start a new chain.\n */\n private attachPrimitiveToAnyChain(candidate: CurvePrimitive, tolerance: number): boolean {\n if (candidate) {\n this._xyzWork0 = candidate.startPoint(this._xyzWork0);\n let connect = this.findAnyChainToConnect(this._xyzWork0, tolerance);\n if (connect) {\n if (connect.atEnd) {\n const chain = this._chains[connect.chainIndex];\n const index0 = chain.length - 1;\n this._chains[connect.chainIndex].push(candidate);\n MultiChainCollector.moveHeadOrTail(chain[index0], chain[index0 + 1], this._gapTolerance);\n this.searchAndMergeChainIndex(connect.chainIndex, tolerance);\n return true;\n } else {\n candidate.reverseInPlace();\n const chain = this._chains[connect.chainIndex];\n chain.splice(0, 0, candidate);\n MultiChainCollector.moveHeadOrTail(chain[0], chain[1], this._gapTolerance);\n this.searchAndMergeChainIndex(connect.chainIndex, tolerance);\n return true;\n }\n } else {\n this._xyzWork0 = candidate.endPoint(this._xyzWork0);\n connect = this.findAnyChainToConnect(this._xyzWork0, tolerance);\n if (connect) {\n if (connect.atEnd) {\n candidate.reverseInPlace();\n const chain = this._chains[connect.chainIndex];\n const index0 = chain.length - 1;\n this._chains[connect.chainIndex].push(candidate);\n MultiChainCollector.moveHeadOrTail(chain[index0], chain[index0 + 1], this._gapTolerance);\n this.searchAndMergeChainIndex(connect.chainIndex, tolerance);\n return true;\n } else {\n const chain = this._chains[connect.chainIndex];\n chain.splice(0, 0, candidate);\n MultiChainCollector.moveHeadOrTail(chain[0], chain[1], this._gapTolerance);\n this.searchAndMergeChainIndex(connect.chainIndex, tolerance);\n return true;\n }\n }\n }\n }\n return false;\n }\n /**\n * Merge two entries in the chain array.\n * * Move each primitive from chainB to the end of chainA.\n * * Clear chainB.\n * * Move the final chain to chainB index.\n * * Decrement the array length.\n * @param chainIndexA index of chainA\n * @param chainIndexB index of chainB\n */\n private mergeChainsForwardForward(chainIndexA: number, chainIndexB: number) {\n const chainA = this._chains[chainIndexA];\n const chainB = this._chains[chainIndexB];\n for (const p of chainB) {\n chainA.push(p);\n }\n chainB.length = 0; // chainIndexB is unused\n const lastChainIndex = this._chains.length - 1;\n if (chainIndexB !== lastChainIndex)\n this._chains[chainIndexB] = this._chains[lastChainIndex];\n this._chains.pop();\n }\n /** Reverse the curve chain in place. */\n private reverseChain(chainIndex: number) {\n const chain = this._chains[chainIndex];\n chain.reverse();\n for (const p of chain)\n p.reverseInPlace();\n }\n /** See if the head or tail of chainIndex matches any existing chain. If so, merge the two chains. */\n private searchAndMergeChainIndex(chainIndex: number, tolerance: number): void {\n // ASSUME valid index of non-empty chain\n const chain = this._chains[chainIndex];\n const lastIndexInChain = chain.length - 1;\n this._xyzWork0 = chain[0].startPoint(this._xyzWork0);\n // try start with any other chain\n let connect = this.findAnyChainToConnect(this._xyzWork0, tolerance, chainIndex);\n if (connect) {\n if (!connect.atEnd)\n this.reverseChain(connect.chainIndex);\n this.mergeChainsForwardForward(connect.chainIndex, chainIndex);\n return;\n }\n // try end with any other chain\n this._xyzWork0 = chain[lastIndexInChain].endPoint(this._xyzWork0);\n connect = this.findAnyChainToConnect(this._xyzWork0, tolerance, chainIndex);\n if (connect) {\n if (connect.atEnd)\n this.reverseChain(connect.chainIndex);\n this.mergeChainsForwardForward(chainIndex, connect.chainIndex);\n return;\n }\n }\n /**\n * Convert an array of curve primitives into the simplest possible strongly typed curve structure.\n * @param curves input array, assembled correctly into a single contiguous path, captured by returned object\n * @param makeLoopIfClosed whether to return a Loop from physically closed curves array, otherwise Path\n * @return Loop or Path if multiple curves; the primitive if only one curve; undefined if no curves\n */\n private promoteArrayToCurves(curves: CurvePrimitive[], makeLoopIfClosed: boolean): CurvePrimitive | Path | Loop | undefined {\n if (curves.length === 0)\n return undefined;\n if (makeLoopIfClosed) {\n const primitive0 = curves[0];\n const primitiveN = curves[curves.length - 1];\n MultiChainCollector._staticPointA = primitive0.startPoint(MultiChainCollector._staticPointA);\n MultiChainCollector._staticPointB = primitiveN.endPoint(MultiChainCollector._staticPointB);\n if (MultiChainCollector.moveHeadOrTail(primitiveN, primitive0, this._gapTolerance)) {\n // get the corrected coordinates\n MultiChainCollector._staticPointA = primitive0.startPoint(MultiChainCollector._staticPointA);\n MultiChainCollector._staticPointB = primitiveN.endPoint(MultiChainCollector._staticPointB);\n }\n if (MultiChainCollector._staticPointA.isAlmostEqual(MultiChainCollector._staticPointB, this._gapTolerance)) {\n const localToWorld = FrameBuilder.createRightHandedLocalToWorld(curves);\n if (localToWorld) {\n const worldToLocal = localToWorld.inverse();\n if (worldToLocal) {\n const range = RegionOps.curveArrayRange(curves, worldToLocal);\n if (this._planeTolerance !== undefined && range.zLength() <= this._planeTolerance) {\n return Loop.createArray(curves);\n }\n }\n }\n return Path.createArray(curves);\n }\n }\n if (curves.length === 1)\n return curves[0];\n return Path.createArray(curves);\n }\n /** Stroke the curve chain to a line string, de-duplicate the points. */\n private chainToLineString3d(chain: CurvePrimitive[], options?: StrokeOptions): LineString3d | undefined {\n if (chain.length === 0)\n return undefined;\n const linestring = LineString3d.create();\n for (const curve of chain)\n curve.emitStrokes(linestring, options);\n linestring.removeDuplicatePoints(this._gapTolerance);\n return linestring;\n }\n /** Return the collected results, structured as the simplest possible type. */\n public grabResult(makeLoopIfClosed: boolean = false): ChainTypes {\n const chains = this._chains;\n if (chains.length === 0)\n return undefined;\n if (chains.length === 1)\n return this.promoteArrayToCurves(chains[0], makeLoopIfClosed);\n const bag = BagOfCurves.create();\n for (const chain of chains) {\n const q = this.promoteArrayToCurves(chain, makeLoopIfClosed);\n bag.tryAddChild(q);\n }\n return bag;\n }\n /** Return chains as individual calls to announceChain. */\n public announceChainsAsLineString3d(announceChain: (ls: LineString3d) => void, options?: StrokeOptions): void {\n const chains = this._chains;\n if (chains.length === 1) {\n const ls = this.chainToLineString3d(chains[0], options);\n if (ls)\n announceChain(ls);\n } else if (chains.length > 1) {\n for (const chain of chains) {\n const ls = this.chainToLineString3d(chain, options);\n if (ls)\n announceChain(ls);\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"MultiChainCollector.js","sourceRoot":"","sources":["../../../../src/cur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AC1B,MAAM,CAAC,GAAG,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;YAC7D,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;SACpB;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IACD,0DAA0D;IACnD,4BAA4B,CAAC,aAAyC,EAAE,OAAuB;QACpG,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YACvB,MAAM,EAAE,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;YACxD,IAAI,EAAE;gBACJ,aAAa,CAAC,EAAE,CAAC,CAAC;SACrB;aAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YAC5B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;gBAC1B,MAAM,EAAE,GAAG,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;gBACpD,IAAI,EAAE;oBACJ,aAAa,CAAC,EAAE,CAAC,CAAC;aACrB;SACF;IACH,CAAC;CACF;AApTD,kDAoTC","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 { FrameBuilder } from \"../../geometry3d/FrameBuilder\";\r\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { XYAndZ } from \"../../geometry3d/XYZProps\";\r\nimport { Arc3d } from \"../Arc3d\";\r\nimport { AnyCurve } from \"../CurveChain\";\r\nimport { BagOfCurves, CurveCollection } from \"../CurveCollection\";\r\nimport { CurveCurve } from \"../CurveCurve\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { LineSegment3d } from \"../LineSegment3d\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { Loop } from \"../Loop\";\r\nimport { Path } from \"../Path\";\r\nimport { ChainTypes, RegionOps } from \"../RegionOps\";\r\nimport { StrokeOptions } from \"../StrokeOptions\";\r\n\r\n/**\r\n * Manage a growing array of arrays of curve primitives that are to be joined \"head to tail\" in paths.\r\n * * The caller makes a sequence of calls to announce individual primitives.\r\n * * This collector (unlike the simpler [[ChainCollectorContext]]) expects to have inputs arriving in random order, leaving multiple open chains in play at any time.\r\n * * When all curves have been announced, the call to `grabResults` restructures the various active chains into Paths (and optionally, Loops).\r\n * * Chain formation is dependent upon input fragment order, as a greedy algorithm is employed.\r\n * * Usage pattern is\r\n * * initialization: `context = new MultiChainCollector(gapTol, planeTol)`\r\n * * many times:\r\n * * `context.captureCurve(anyCurve)`\r\n * * `context.captureCurvePrimitive(primitive)`\r\n * * end: `result = context.grabResult(makeLoopIfClosed)`\r\n * @internal\r\n */\r\nexport class MultiChainCollector {\r\n /** accumulated chains */\r\n private _chains: CurvePrimitive[][];\r\n /** largest gap distance to close */\r\n private _gapTolerance: number;\r\n /** end point snap tolerance (assumed to be as tight or tighter than gapTolerance) */\r\n private _snapTolerance: number;\r\n /** tolerance for choosing Path or Loop. If undefined, always Path. */\r\n private _planeTolerance: number | undefined;\r\n\r\n private static _staticPointA: Point3d;\r\n private static _staticPointB: Point3d;\r\n private _xyzWork0?: Point3d;\r\n private _xyzWork1?: Point3d;\r\n\r\n /** Initialize with an empty array of chains.\r\n * @param gapTolerance tolerance for calling endpoints identical\r\n * @param planeTolerance tolerance for considering a closed chain to be planar. If undefined, only create Path. If defined, create Loops for closed chains within tolerance of a plane.\r\n */\r\n public constructor(gapTolerance = Geometry.smallMetricDistance, planeTolerance: number | undefined = Geometry.smallMetricDistance) {\r\n this._chains = [];\r\n this._gapTolerance = gapTolerance;\r\n this._snapTolerance = Geometry.smallMetricDistance;\r\n this._planeTolerance = planeTolerance;\r\n }\r\n /**\r\n * Find a chain (with index _other than_ exceptChainIndex) that starts or ends at xyz\r\n * @param xyz endpoint to check\r\n * @param tolerance absolute distance tolerance for equating endpoints\r\n * @param exceptChainIndex index of chain to ignore. Send -1 to consider all chains.\r\n */\r\n private findAnyChainToConnect(xyz: Point3d, tolerance: number, exceptChainIndex: number = -1): { chainIndex: number, atEnd: boolean } | undefined {\r\n for (let chainIndexA = 0; chainIndexA < this._chains.length; chainIndexA++) {\r\n if (exceptChainIndex === chainIndexA)\r\n continue;\r\n const chain = this._chains[chainIndexA];\r\n this._xyzWork1 = chain[chain.length - 1].endPoint(this._xyzWork1);\r\n if (this._xyzWork1.isAlmostEqual(xyz, tolerance))\r\n return { chainIndex: chainIndexA, atEnd: true };\r\n this._xyzWork1 = chain[0].startPoint(this._xyzWork1);\r\n if (this._xyzWork1.isAlmostEqual(xyz, tolerance))\r\n return { chainIndex: chainIndexA, atEnd: false };\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Insert a single curve primitive into the active chains.\r\n * * The primitive is captured (not cloned)\r\n * * The primitive may be reversed in place\r\n * @param candidate curve to add to the context\r\n */\r\n public captureCurvePrimitive(candidate: CurvePrimitive) {\r\n if (this._snapTolerance < this._gapTolerance) {\r\n if (this.attachPrimitiveToAnyChain(candidate, this._snapTolerance))\r\n return;\r\n }\r\n if (this.attachPrimitiveToAnyChain(candidate, this._gapTolerance))\r\n return;\r\n this._chains.push([candidate]);\r\n }\r\n /**\r\n * Insert any curve into the collection.\r\n * * This recurses into Path, Loop, BagOfCurves etc\r\n * * All primitives are captured, and may be reversed in place.\r\n * @param candidate curve to add to the context\r\n */\r\n public captureCurve(candidate: AnyCurve) {\r\n if (candidate instanceof CurvePrimitive)\r\n this.captureCurvePrimitive(candidate);\r\n else if (candidate instanceof CurveCollection && candidate.children !== undefined) {\r\n for (const c of candidate.children) {\r\n this.captureCurve(c as AnyCurve);\r\n }\r\n }\r\n }\r\n /** If allowed by the geometry type, move an endpoint. */\r\n private static simpleEndPointMove(curve: CurvePrimitive, atEnd: boolean, to: XYAndZ): boolean {\r\n if (curve instanceof (LineSegment3d)) {\r\n if (atEnd) {\r\n curve.point1Ref.setFrom(to);\r\n } else {\r\n curve.point0Ref.setFrom(to);\r\n }\r\n return true;\r\n } else if (curve instanceof LineString3d && curve.numPoints() > 0) {\r\n const i = atEnd ? curve.numPoints() - 1 : 0;\r\n curve.packedPoints.setAtCheckedPointIndex(i, to);\r\n return true;\r\n }\r\n return false;\r\n }\r\n /**\r\n * Try to move the end of curve0 and/or the start of curve1 to a common point.\r\n * * All z-coordinates are ignored.\r\n * @param curve0 first curve, assumed to end close to the start of curve1\r\n * @param curve1 second curve, assumed to start close to the end of curve0\r\n * @param gapTolerance max distance to move a curve start/end point\r\n * @returns whether curve start/end point(s) moved\r\n */\r\n private static moveHeadOrTail(curve0: CurvePrimitive, curve1: CurvePrimitive, gapTolerance: number): boolean {\r\n const xyz0 = curve0.endPoint();\r\n const xyz1 = curve1.startPoint();\r\n const minShift = Geometry.smallMetricDistance * 0.001;\r\n const d01 = xyz0.distanceXY(xyz1);\r\n if (d01 < minShift)\r\n return false;\r\n // try lines and linestrings\r\n if (d01 < gapTolerance) {\r\n if (this.simpleEndPointMove(curve1, false, xyz0) || this.simpleEndPointMove(curve0, true, xyz1))\r\n return true;\r\n }\r\n // try other primitive types\r\n const intersections = CurveCurve.intersectionXYPairs(curve0, true, curve1, true);\r\n const shiftFactor = 5.0;\r\n for (const pair of intersections) {\r\n const detail0 = pair.detailA;\r\n const detail1 = pair.detailB;\r\n const distance0 = detail0.point.distanceXY(xyz0);\r\n const distance1 = detail1.point.distanceXY(xyz1);\r\n if (distance0 < shiftFactor * gapTolerance && distance1 < shiftFactor * gapTolerance) {\r\n if (curve0 instanceof Arc3d && curve1 instanceof Arc3d) {\r\n const radians0End = curve0.sweep.fractionToRadians(detail0.fraction);\r\n curve0.sweep.setStartEndRadians(curve0.sweep.startRadians, radians0End);\r\n const radians1Start = curve1.sweep.fractionToRadians(detail1.fraction);\r\n curve1.sweep.setStartEndRadians(radians1Start, curve1.sweep.endRadians);\r\n return true;\r\n }\r\n // TODO: other combinations of types\r\n }\r\n }\r\n return false;\r\n }\r\n /** Announce a curve primitive\r\n * * If a \"nearby\" connection is possible, insert the candidate in the chain and force endpoint match.\r\n * * Otherwise start a new chain.\r\n */\r\n private attachPrimitiveToAnyChain(candidate: CurvePrimitive, tolerance: number): boolean {\r\n if (candidate) {\r\n this._xyzWork0 = candidate.startPoint(this._xyzWork0);\r\n let connect = this.findAnyChainToConnect(this._xyzWork0, tolerance);\r\n if (connect) {\r\n if (connect.atEnd) {\r\n const chain = this._chains[connect.chainIndex];\r\n const index0 = chain.length - 1;\r\n this._chains[connect.chainIndex].push(candidate);\r\n MultiChainCollector.moveHeadOrTail(chain[index0], chain[index0 + 1], this._gapTolerance);\r\n this.searchAndMergeChainIndex(connect.chainIndex, tolerance);\r\n return true;\r\n } else {\r\n candidate.reverseInPlace();\r\n const chain = this._chains[connect.chainIndex];\r\n chain.splice(0, 0, candidate);\r\n MultiChainCollector.moveHeadOrTail(chain[0], chain[1], this._gapTolerance);\r\n this.searchAndMergeChainIndex(connect.chainIndex, tolerance);\r\n return true;\r\n }\r\n } else {\r\n this._xyzWork0 = candidate.endPoint(this._xyzWork0);\r\n connect = this.findAnyChainToConnect(this._xyzWork0, tolerance);\r\n if (connect) {\r\n if (connect.atEnd) {\r\n candidate.reverseInPlace();\r\n const chain = this._chains[connect.chainIndex];\r\n const index0 = chain.length - 1;\r\n this._chains[connect.chainIndex].push(candidate);\r\n MultiChainCollector.moveHeadOrTail(chain[index0], chain[index0 + 1], this._gapTolerance);\r\n this.searchAndMergeChainIndex(connect.chainIndex, tolerance);\r\n return true;\r\n } else {\r\n const chain = this._chains[connect.chainIndex];\r\n chain.splice(0, 0, candidate);\r\n MultiChainCollector.moveHeadOrTail(chain[0], chain[1], this._gapTolerance);\r\n this.searchAndMergeChainIndex(connect.chainIndex, tolerance);\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n /**\r\n * Merge two entries in the chain array.\r\n * * Move each primitive from chainB to the end of chainA.\r\n * * Clear chainB.\r\n * * Move the final chain to chainB index.\r\n * * Decrement the array length.\r\n * @param chainIndexA index of chainA\r\n * @param chainIndexB index of chainB\r\n */\r\n private mergeChainsForwardForward(chainIndexA: number, chainIndexB: number) {\r\n const chainA = this._chains[chainIndexA];\r\n const chainB = this._chains[chainIndexB];\r\n for (const p of chainB) {\r\n chainA.push(p);\r\n }\r\n chainB.length = 0; // chainIndexB is unused\r\n const lastChainIndex = this._chains.length - 1;\r\n if (chainIndexB !== lastChainIndex)\r\n this._chains[chainIndexB] = this._chains[lastChainIndex];\r\n this._chains.pop();\r\n }\r\n /** Reverse the curve chain in place. */\r\n private reverseChain(chainIndex: number) {\r\n const chain = this._chains[chainIndex];\r\n chain.reverse();\r\n for (const p of chain)\r\n p.reverseInPlace();\r\n }\r\n /** See if the head or tail of chainIndex matches any existing chain. If so, merge the two chains. */\r\n private searchAndMergeChainIndex(chainIndex: number, tolerance: number): void {\r\n // ASSUME valid index of non-empty chain\r\n const chain = this._chains[chainIndex];\r\n const lastIndexInChain = chain.length - 1;\r\n this._xyzWork0 = chain[0].startPoint(this._xyzWork0);\r\n // try start with any other chain\r\n let connect = this.findAnyChainToConnect(this._xyzWork0, tolerance, chainIndex);\r\n if (connect) {\r\n if (!connect.atEnd)\r\n this.reverseChain(connect.chainIndex);\r\n this.mergeChainsForwardForward(connect.chainIndex, chainIndex);\r\n return;\r\n }\r\n // try end with any other chain\r\n this._xyzWork0 = chain[lastIndexInChain].endPoint(this._xyzWork0);\r\n connect = this.findAnyChainToConnect(this._xyzWork0, tolerance, chainIndex);\r\n if (connect) {\r\n if (connect.atEnd)\r\n this.reverseChain(connect.chainIndex);\r\n this.mergeChainsForwardForward(chainIndex, connect.chainIndex);\r\n return;\r\n }\r\n }\r\n /**\r\n * Convert an array of curve primitives into the simplest possible strongly typed curve structure.\r\n * @param curves input array, assembled correctly into a single contiguous path, captured by returned object\r\n * @param makeLoopIfClosed whether to return a Loop from physically closed curves array, otherwise Path\r\n * @return Loop or Path if multiple curves; the primitive if only one curve; undefined if no curves\r\n */\r\n private promoteArrayToCurves(curves: CurvePrimitive[], makeLoopIfClosed: boolean): CurvePrimitive | Path | Loop | undefined {\r\n if (curves.length === 0)\r\n return undefined;\r\n if (makeLoopIfClosed) {\r\n const primitive0 = curves[0];\r\n const primitiveN = curves[curves.length - 1];\r\n MultiChainCollector._staticPointA = primitive0.startPoint(MultiChainCollector._staticPointA);\r\n MultiChainCollector._staticPointB = primitiveN.endPoint(MultiChainCollector._staticPointB);\r\n if (MultiChainCollector.moveHeadOrTail(primitiveN, primitive0, this._gapTolerance)) {\r\n // get the corrected coordinates\r\n MultiChainCollector._staticPointA = primitive0.startPoint(MultiChainCollector._staticPointA);\r\n MultiChainCollector._staticPointB = primitiveN.endPoint(MultiChainCollector._staticPointB);\r\n }\r\n if (MultiChainCollector._staticPointA.isAlmostEqual(MultiChainCollector._staticPointB, this._gapTolerance)) {\r\n const localToWorld = FrameBuilder.createRightHandedLocalToWorld(curves);\r\n if (localToWorld) {\r\n const worldToLocal = localToWorld.inverse();\r\n if (worldToLocal) {\r\n const range = RegionOps.curveArrayRange(curves, worldToLocal);\r\n if (this._planeTolerance !== undefined && range.zLength() <= this._planeTolerance) {\r\n return Loop.createArray(curves);\r\n }\r\n }\r\n }\r\n return Path.createArray(curves);\r\n }\r\n }\r\n if (curves.length === 1)\r\n return curves[0];\r\n return Path.createArray(curves);\r\n }\r\n /** Stroke the curve chain to a line string, de-duplicate the points. */\r\n private chainToLineString3d(chain: CurvePrimitive[], options?: StrokeOptions): LineString3d | undefined {\r\n if (chain.length === 0)\r\n return undefined;\r\n const linestring = LineString3d.create();\r\n for (const curve of chain)\r\n curve.emitStrokes(linestring, options);\r\n linestring.removeDuplicatePoints(this._gapTolerance);\r\n return linestring;\r\n }\r\n /** Return the collected results, structured as the simplest possible type. */\r\n public grabResult(makeLoopIfClosed: boolean = false): ChainTypes {\r\n const chains = this._chains;\r\n if (chains.length === 0)\r\n return undefined;\r\n if (chains.length === 1)\r\n return this.promoteArrayToCurves(chains[0], makeLoopIfClosed);\r\n const bag = BagOfCurves.create();\r\n for (const chain of chains) {\r\n const q = this.promoteArrayToCurves(chain, makeLoopIfClosed);\r\n bag.tryAddChild(q);\r\n }\r\n return bag;\r\n }\r\n /** Return chains as individual calls to announceChain. */\r\n public announceChainsAsLineString3d(announceChain: (ls: LineString3d) => void, options?: StrokeOptions): void {\r\n const chains = this._chains;\r\n if (chains.length === 1) {\r\n const ls = this.chainToLineString3d(chains[0], options);\r\n if (ls)\r\n announceChain(ls);\r\n } else if (chains.length > 1) {\r\n for (const chain of chains) {\r\n const ls = this.chainToLineString3d(chain, options);\r\n if (ls)\r\n announceChain(ls);\r\n }\r\n }\r\n }\r\n}\r\n"]}