@itwin/core-geometry 4.0.0-dev.99 → 4.0.2

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 (460) hide show
  1. package/CHANGELOG.md +57 -1
  2. package/lib/cjs/Constant.js.map +1 -1
  3. package/lib/cjs/Geometry.d.ts.map +1 -1
  4. package/lib/cjs/Geometry.js +8 -5
  5. package/lib/cjs/Geometry.js.map +1 -1
  6. package/lib/cjs/bspline/AkimaCurve3d.js.map +1 -1
  7. package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
  8. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  9. package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
  10. package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
  11. package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
  12. package/lib/cjs/bspline/Bezier1dNd.js.map +1 -1
  13. package/lib/cjs/bspline/BezierCurve3d.js.map +1 -1
  14. package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
  15. package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
  16. package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
  17. package/lib/cjs/bspline/KnotVector.js.map +1 -1
  18. package/lib/cjs/bspline/SurfaceLocationDetail.js.map +1 -1
  19. package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
  20. package/lib/cjs/clipping/BooleanClipFactory.js.map +1 -1
  21. package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
  22. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  23. package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
  24. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  25. package/lib/cjs/clipping/ClipVector.js.map +1 -1
  26. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  27. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  28. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  29. package/lib/cjs/core-geometry.js.map +1 -1
  30. package/lib/cjs/curve/Arc3d.js.map +1 -1
  31. package/lib/cjs/curve/ChainCollectorContext.js.map +1 -1
  32. package/lib/cjs/curve/ConstructCurveBetweenCurves.js.map +1 -1
  33. package/lib/cjs/curve/CoordinateXYZ.js.map +1 -1
  34. package/lib/cjs/curve/CurveChain.js.map +1 -1
  35. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  36. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  37. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  38. package/lib/cjs/curve/CurveCurveCloseApproachXY.js.map +1 -1
  39. package/lib/cjs/curve/CurveCurveIntersectXY.d.ts.map +1 -1
  40. package/lib/cjs/curve/CurveCurveIntersectXY.js +3 -3
  41. package/lib/cjs/curve/CurveCurveIntersectXY.js.map +1 -1
  42. package/lib/cjs/curve/CurveCurveIntersectXYZ.js.map +1 -1
  43. package/lib/cjs/curve/CurveExtendMode.js.map +1 -1
  44. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  45. package/lib/cjs/curve/CurveLocationDetail.d.ts +1 -1
  46. package/lib/cjs/curve/CurveLocationDetail.js +1 -1
  47. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  48. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  49. package/lib/cjs/curve/CurveProcessor.js.map +1 -1
  50. package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
  51. package/lib/cjs/curve/GeometryQuery.js.map +1 -1
  52. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  53. package/lib/cjs/curve/LineString3d.js.map +1 -1
  54. package/lib/cjs/curve/Loop.js.map +1 -1
  55. package/lib/cjs/curve/ParityRegion.js.map +1 -1
  56. package/lib/cjs/curve/Path.js.map +1 -1
  57. package/lib/cjs/curve/PointString3d.js.map +1 -1
  58. package/lib/cjs/curve/ProxyCurve.js.map +1 -1
  59. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  60. package/lib/cjs/curve/Query/CurveSplitContext.js.map +1 -1
  61. package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
  62. package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
  63. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +3 -2
  64. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  65. package/lib/cjs/curve/Query/PlanarSubdivision.js +57 -43
  66. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  67. package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
  68. package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
  69. package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
  70. package/lib/cjs/curve/RegionOps.d.ts +7 -5
  71. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  72. package/lib/cjs/curve/RegionOps.js +17 -16
  73. package/lib/cjs/curve/RegionOps.js.map +1 -1
  74. package/lib/cjs/curve/RegionOpsClassificationSweeps.js +1 -1
  75. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  76. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  77. package/lib/cjs/curve/UnionRegion.js.map +1 -1
  78. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
  79. package/lib/cjs/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  80. package/lib/cjs/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
  81. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  82. package/lib/cjs/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
  83. package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -1
  84. package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
  85. package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
  86. package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
  87. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
  88. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  89. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  90. package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
  91. package/lib/cjs/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
  92. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  93. package/lib/cjs/curve/spiral/ClothoidSeries.js.map +1 -1
  94. package/lib/cjs/curve/spiral/CubicEvaluator.js.map +1 -1
  95. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  96. package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  97. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  98. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  99. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  100. package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
  101. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  102. package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  103. package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
  104. package/lib/cjs/curve/spiral/XYCurveEvaluator.js.map +1 -1
  105. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  106. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  107. package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
  108. package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
  109. package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts +9 -9
  110. package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
  111. package/lib/cjs/geometry3d/CoincidentGeometryOps.js +82 -56
  112. package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
  113. package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
  114. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  115. package/lib/cjs/geometry3d/FrustumAnimation.js.map +1 -1
  116. package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
  117. package/lib/cjs/geometry3d/GrowableBlockedArray.js.map +1 -1
  118. package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
  119. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  120. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  121. package/lib/cjs/geometry3d/IndexedCollectionInterval.js.map +1 -1
  122. package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
  123. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  124. package/lib/cjs/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
  125. package/lib/cjs/geometry3d/Matrix3d.js +1 -1
  126. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  127. package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
  128. package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
  129. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  130. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  131. package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
  132. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  133. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  134. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  135. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  136. package/lib/cjs/geometry3d/PointStreaming.js.map +1 -1
  137. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  138. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  139. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  140. package/lib/cjs/geometry3d/Range.js.map +1 -1
  141. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  142. package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
  143. package/lib/cjs/geometry3d/Segment1d.js.map +1 -1
  144. package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
  145. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  146. package/lib/cjs/geometry3d/UVSurfaceOps.js.map +1 -1
  147. package/lib/cjs/geometry3d/XYZProps.js.map +1 -1
  148. package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
  149. package/lib/cjs/geometry4d/Map4d.js.map +1 -1
  150. package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
  151. package/lib/cjs/geometry4d/MomentData.js.map +1 -1
  152. package/lib/cjs/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
  153. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  154. package/lib/cjs/numerics/BandedSystem.js.map +1 -1
  155. package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
  156. package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
  157. package/lib/cjs/numerics/Complex.js.map +1 -1
  158. package/lib/cjs/numerics/ConvexPolygon2d.js.map +1 -1
  159. package/lib/cjs/numerics/Newton.js.map +1 -1
  160. package/lib/cjs/numerics/PascalCoefficients.js.map +1 -1
  161. package/lib/cjs/numerics/PolarData.js.map +1 -1
  162. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  163. package/lib/cjs/numerics/Quadrature.js.map +1 -1
  164. package/lib/cjs/numerics/Range1dArray.js.map +1 -1
  165. package/lib/cjs/numerics/TriDiagonalSystem.js.map +1 -1
  166. package/lib/cjs/numerics/UnionFind.js.map +1 -1
  167. package/lib/cjs/numerics/UsageSums.js.map +1 -1
  168. package/lib/cjs/polyface/AuxData.js.map +1 -1
  169. package/lib/cjs/polyface/BoxTopology.js.map +1 -1
  170. package/lib/cjs/polyface/FacetFaceData.js.map +1 -1
  171. package/lib/cjs/polyface/FacetLocationDetail.js.map +1 -1
  172. package/lib/cjs/polyface/FacetOrientation.js.map +1 -1
  173. package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  174. package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
  175. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  176. package/lib/cjs/polyface/Polyface.js.map +1 -1
  177. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  178. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  179. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  180. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  181. package/lib/cjs/polyface/RangeLengthData.js.map +1 -1
  182. package/lib/cjs/polyface/TaggedNumericData.js.map +1 -1
  183. package/lib/cjs/polyface/TriangleCandidate.js.map +1 -1
  184. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  185. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  186. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  187. package/lib/cjs/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
  188. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  189. package/lib/cjs/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
  190. package/lib/cjs/polyface/multiclip/RangeSearch.js.map +1 -1
  191. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  192. package/lib/cjs/polyface/multiclip/XYPointBuckets.js.map +1 -1
  193. package/lib/cjs/serialization/BGFBAccessors.js.map +1 -1
  194. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  195. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  196. package/lib/cjs/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
  197. package/lib/cjs/serialization/DeepCompare.js.map +1 -1
  198. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  199. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  200. package/lib/cjs/solid/Box.js.map +1 -1
  201. package/lib/cjs/solid/Cone.js.map +1 -1
  202. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  203. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  204. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  205. package/lib/cjs/solid/SolidPrimitive.js.map +1 -1
  206. package/lib/cjs/solid/Sphere.js.map +1 -1
  207. package/lib/cjs/solid/SweepContour.js.map +1 -1
  208. package/lib/cjs/solid/TorusPipe.js.map +1 -1
  209. package/lib/cjs/topology/ChainMerge.js.map +1 -1
  210. package/lib/cjs/topology/Graph.js.map +1 -1
  211. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  212. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  213. package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  214. package/lib/cjs/topology/HalfEdgeGraphValidation.js.map +1 -1
  215. package/lib/cjs/topology/HalfEdgeMarkSet.js.map +1 -1
  216. package/lib/cjs/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  217. package/lib/cjs/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  218. package/lib/cjs/topology/HalfEdgePositionDetail.js.map +1 -1
  219. package/lib/cjs/topology/HalfEdgePriorityQueue.js.map +1 -1
  220. package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
  221. package/lib/cjs/topology/MaskManager.js.map +1 -1
  222. package/lib/cjs/topology/Merging.d.ts +1 -0
  223. package/lib/cjs/topology/Merging.d.ts.map +1 -1
  224. package/lib/cjs/topology/Merging.js +1 -0
  225. package/lib/cjs/topology/Merging.js.map +1 -1
  226. package/lib/cjs/topology/RegularizeFace.js.map +1 -1
  227. package/lib/cjs/topology/SignedDataSummary.js.map +1 -1
  228. package/lib/cjs/topology/SpaceTriangulation.js.map +1 -1
  229. package/lib/cjs/topology/Triangulation.js.map +1 -1
  230. package/lib/cjs/topology/XYParitySearchContext.js.map +1 -1
  231. package/lib/esm/Constant.js.map +1 -1
  232. package/lib/esm/Geometry.d.ts.map +1 -1
  233. package/lib/esm/Geometry.js +8 -5
  234. package/lib/esm/Geometry.js.map +1 -1
  235. package/lib/esm/bspline/AkimaCurve3d.js.map +1 -1
  236. package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
  237. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  238. package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
  239. package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
  240. package/lib/esm/bspline/BSplineSurface.js.map +1 -1
  241. package/lib/esm/bspline/Bezier1dNd.js.map +1 -1
  242. package/lib/esm/bspline/BezierCurve3d.js.map +1 -1
  243. package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
  244. package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
  245. package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
  246. package/lib/esm/bspline/KnotVector.js.map +1 -1
  247. package/lib/esm/bspline/SurfaceLocationDetail.js.map +1 -1
  248. package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
  249. package/lib/esm/clipping/BooleanClipFactory.js.map +1 -1
  250. package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
  251. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  252. package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
  253. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  254. package/lib/esm/clipping/ClipVector.js.map +1 -1
  255. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  256. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  257. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  258. package/lib/esm/core-geometry.js.map +1 -1
  259. package/lib/esm/curve/Arc3d.js.map +1 -1
  260. package/lib/esm/curve/ChainCollectorContext.js.map +1 -1
  261. package/lib/esm/curve/ConstructCurveBetweenCurves.js.map +1 -1
  262. package/lib/esm/curve/CoordinateXYZ.js.map +1 -1
  263. package/lib/esm/curve/CurveChain.js.map +1 -1
  264. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  265. package/lib/esm/curve/CurveCollection.js.map +1 -1
  266. package/lib/esm/curve/CurveCurve.js.map +1 -1
  267. package/lib/esm/curve/CurveCurveCloseApproachXY.js.map +1 -1
  268. package/lib/esm/curve/CurveCurveIntersectXY.d.ts.map +1 -1
  269. package/lib/esm/curve/CurveCurveIntersectXY.js +3 -3
  270. package/lib/esm/curve/CurveCurveIntersectXY.js.map +1 -1
  271. package/lib/esm/curve/CurveCurveIntersectXYZ.js.map +1 -1
  272. package/lib/esm/curve/CurveExtendMode.js.map +1 -1
  273. package/lib/esm/curve/CurveFactory.js.map +1 -1
  274. package/lib/esm/curve/CurveLocationDetail.d.ts +1 -1
  275. package/lib/esm/curve/CurveLocationDetail.js +1 -1
  276. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  277. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  278. package/lib/esm/curve/CurveProcessor.js.map +1 -1
  279. package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
  280. package/lib/esm/curve/GeometryQuery.js.map +1 -1
  281. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  282. package/lib/esm/curve/LineString3d.js.map +1 -1
  283. package/lib/esm/curve/Loop.js.map +1 -1
  284. package/lib/esm/curve/ParityRegion.js.map +1 -1
  285. package/lib/esm/curve/Path.js.map +1 -1
  286. package/lib/esm/curve/PointString3d.js.map +1 -1
  287. package/lib/esm/curve/ProxyCurve.js.map +1 -1
  288. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  289. package/lib/esm/curve/Query/CurveSplitContext.js.map +1 -1
  290. package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
  291. package/lib/esm/curve/Query/InOutTests.js.map +1 -1
  292. package/lib/esm/curve/Query/PlanarSubdivision.d.ts +3 -2
  293. package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  294. package/lib/esm/curve/Query/PlanarSubdivision.js +58 -44
  295. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  296. package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
  297. package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
  298. package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
  299. package/lib/esm/curve/RegionOps.d.ts +7 -5
  300. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  301. package/lib/esm/curve/RegionOps.js +17 -16
  302. package/lib/esm/curve/RegionOps.js.map +1 -1
  303. package/lib/esm/curve/RegionOpsClassificationSweeps.js +1 -1
  304. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  305. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  306. package/lib/esm/curve/UnionRegion.js.map +1 -1
  307. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
  308. package/lib/esm/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  309. package/lib/esm/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
  310. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  311. package/lib/esm/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
  312. package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -1
  313. package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
  314. package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
  315. package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
  316. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
  317. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  318. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  319. package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
  320. package/lib/esm/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
  321. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  322. package/lib/esm/curve/spiral/ClothoidSeries.js.map +1 -1
  323. package/lib/esm/curve/spiral/CubicEvaluator.js.map +1 -1
  324. package/lib/esm/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  325. package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  326. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  327. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  328. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  329. package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
  330. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  331. package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  332. package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
  333. package/lib/esm/curve/spiral/XYCurveEvaluator.js.map +1 -1
  334. package/lib/esm/geometry3d/Angle.js.map +1 -1
  335. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  336. package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
  337. package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
  338. package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts +9 -9
  339. package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
  340. package/lib/esm/geometry3d/CoincidentGeometryOps.js +82 -56
  341. package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
  342. package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
  343. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  344. package/lib/esm/geometry3d/FrustumAnimation.js.map +1 -1
  345. package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
  346. package/lib/esm/geometry3d/GrowableBlockedArray.js.map +1 -1
  347. package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
  348. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  349. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  350. package/lib/esm/geometry3d/IndexedCollectionInterval.js.map +1 -1
  351. package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
  352. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  353. package/lib/esm/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
  354. package/lib/esm/geometry3d/Matrix3d.js +1 -1
  355. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  356. package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
  357. package/lib/esm/geometry3d/Plane3d.js.map +1 -1
  358. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  359. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  360. package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
  361. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  362. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  363. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  364. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  365. package/lib/esm/geometry3d/PointStreaming.js.map +1 -1
  366. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  367. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  368. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  369. package/lib/esm/geometry3d/Range.js.map +1 -1
  370. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  371. package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
  372. package/lib/esm/geometry3d/Segment1d.js.map +1 -1
  373. package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
  374. package/lib/esm/geometry3d/Transform.js.map +1 -1
  375. package/lib/esm/geometry3d/UVSurfaceOps.js.map +1 -1
  376. package/lib/esm/geometry3d/XYZProps.js.map +1 -1
  377. package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
  378. package/lib/esm/geometry4d/Map4d.js.map +1 -1
  379. package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
  380. package/lib/esm/geometry4d/MomentData.js.map +1 -1
  381. package/lib/esm/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
  382. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  383. package/lib/esm/numerics/BandedSystem.js.map +1 -1
  384. package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
  385. package/lib/esm/numerics/ClusterableArray.js.map +1 -1
  386. package/lib/esm/numerics/Complex.js.map +1 -1
  387. package/lib/esm/numerics/ConvexPolygon2d.js.map +1 -1
  388. package/lib/esm/numerics/Newton.js.map +1 -1
  389. package/lib/esm/numerics/PascalCoefficients.js.map +1 -1
  390. package/lib/esm/numerics/PolarData.js.map +1 -1
  391. package/lib/esm/numerics/Polynomials.js.map +1 -1
  392. package/lib/esm/numerics/Quadrature.js.map +1 -1
  393. package/lib/esm/numerics/Range1dArray.js.map +1 -1
  394. package/lib/esm/numerics/TriDiagonalSystem.js.map +1 -1
  395. package/lib/esm/numerics/UnionFind.js.map +1 -1
  396. package/lib/esm/numerics/UsageSums.js.map +1 -1
  397. package/lib/esm/polyface/AuxData.js.map +1 -1
  398. package/lib/esm/polyface/BoxTopology.js.map +1 -1
  399. package/lib/esm/polyface/FacetFaceData.js.map +1 -1
  400. package/lib/esm/polyface/FacetLocationDetail.js.map +1 -1
  401. package/lib/esm/polyface/FacetOrientation.js.map +1 -1
  402. package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  403. package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
  404. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  405. package/lib/esm/polyface/Polyface.js.map +1 -1
  406. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  407. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  408. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  409. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  410. package/lib/esm/polyface/RangeLengthData.js.map +1 -1
  411. package/lib/esm/polyface/TaggedNumericData.js.map +1 -1
  412. package/lib/esm/polyface/TriangleCandidate.js.map +1 -1
  413. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  414. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  415. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  416. package/lib/esm/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
  417. package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  418. package/lib/esm/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
  419. package/lib/esm/polyface/multiclip/RangeSearch.js.map +1 -1
  420. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  421. package/lib/esm/polyface/multiclip/XYPointBuckets.js.map +1 -1
  422. package/lib/esm/serialization/BGFBAccessors.js.map +1 -1
  423. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  424. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  425. package/lib/esm/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
  426. package/lib/esm/serialization/DeepCompare.js.map +1 -1
  427. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  428. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  429. package/lib/esm/solid/Box.js.map +1 -1
  430. package/lib/esm/solid/Cone.js.map +1 -1
  431. package/lib/esm/solid/LinearSweep.js.map +1 -1
  432. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  433. package/lib/esm/solid/RuledSweep.js.map +1 -1
  434. package/lib/esm/solid/SolidPrimitive.js.map +1 -1
  435. package/lib/esm/solid/Sphere.js.map +1 -1
  436. package/lib/esm/solid/SweepContour.js.map +1 -1
  437. package/lib/esm/solid/TorusPipe.js.map +1 -1
  438. package/lib/esm/topology/ChainMerge.js.map +1 -1
  439. package/lib/esm/topology/Graph.js.map +1 -1
  440. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  441. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  442. package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  443. package/lib/esm/topology/HalfEdgeGraphValidation.js.map +1 -1
  444. package/lib/esm/topology/HalfEdgeMarkSet.js.map +1 -1
  445. package/lib/esm/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  446. package/lib/esm/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  447. package/lib/esm/topology/HalfEdgePositionDetail.js.map +1 -1
  448. package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
  449. package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
  450. package/lib/esm/topology/MaskManager.js.map +1 -1
  451. package/lib/esm/topology/Merging.d.ts +1 -0
  452. package/lib/esm/topology/Merging.d.ts.map +1 -1
  453. package/lib/esm/topology/Merging.js +1 -0
  454. package/lib/esm/topology/Merging.js.map +1 -1
  455. package/lib/esm/topology/RegularizeFace.js.map +1 -1
  456. package/lib/esm/topology/SignedDataSummary.js.map +1 -1
  457. package/lib/esm/topology/SpaceTriangulation.js.map +1 -1
  458. package/lib/esm/topology/Triangulation.js.map +1 -1
  459. package/lib/esm/topology/XYParitySearchContext.js.map +1 -1
  460. package/package.json +3 -3
@@ -2,6 +2,10 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module CartesianGeometry
7
+ */
8
+ import { assert } from "@itwin/core-bentley";
5
9
  import { CurveLocationDetail, CurveLocationDetailPair } from "../curve/CurveLocationDetail";
6
10
  import { Geometry } from "../Geometry";
7
11
  import { AngleSweep } from "./AngleSweep";
@@ -59,71 +63,71 @@ export class CoincidentGeometryQuery {
59
63
  * @param pointB1 end point of segment B
60
64
  */
61
65
  coincidentSegmentRangeXY(pointA0, pointA1, pointB0, pointB1, restrictToBounds = true) {
62
- const detailAOnB = this.projectPointToSegmentXY(pointA0, pointB0, pointB1);
63
- if (pointA0.distanceXY(detailAOnB.point) > this._tolerance)
66
+ const detailA0OnB = this.projectPointToSegmentXY(pointA0, pointB0, pointB1);
67
+ if (pointA0.distanceXY(detailA0OnB.point) > this._tolerance)
64
68
  return undefined;
65
69
  const detailA1OnB = this.projectPointToSegmentXY(pointA1, pointB0, pointB1);
66
70
  if (pointA1.distanceXY(detailA1OnB.point) > this._tolerance)
67
71
  return undefined;
68
- const detailBOnA = this.projectPointToSegmentXY(pointB0, pointA0, pointA1);
69
- if (pointB0.distanceXY(detailBOnA.point) > this._tolerance)
72
+ const detailB0OnA = this.projectPointToSegmentXY(pointB0, pointA0, pointA1);
73
+ if (pointB0.distanceXY(detailB0OnA.point) > this._tolerance)
70
74
  return undefined;
71
75
  const detailB1OnA = this.projectPointToSegmentXY(pointB1, pointA0, pointA1);
72
76
  if (pointB1.distanceXY(detailB1OnA.point) > this._tolerance)
73
77
  return undefined;
74
- detailAOnB.fraction1 = detailA1OnB.fraction;
75
- detailAOnB.point1 = detailA1OnB.point; // capture -- detailB0OnA is not reused.
76
- detailBOnA.fraction1 = detailB1OnA.fraction;
77
- detailBOnA.point1 = detailB1OnA.point;
78
+ detailA0OnB.fraction1 = detailA1OnB.fraction;
79
+ detailA0OnB.point1 = detailA1OnB.point; // capture -- detailA1OnB is not reused.
80
+ detailB0OnA.fraction1 = detailB1OnA.fraction;
81
+ detailB0OnA.point1 = detailB1OnA.point;
78
82
  if (!restrictToBounds)
79
- return CurveLocationDetailPair.createCapture(detailBOnA, detailAOnB);
80
- const segment = Segment1d.create(detailBOnA.fraction, detailBOnA.fraction1);
83
+ return CurveLocationDetailPair.createCapture(detailB0OnA, detailA0OnB);
84
+ const segment = Segment1d.create(detailB0OnA.fraction, detailB0OnA.fraction1);
81
85
  if (segment.clampDirectedTo01()) {
82
- segment.reverseIfNeededForDeltaSign(1.0);
83
86
  const f0 = segment.x0;
84
87
  const f1 = segment.x1;
85
- const h0 = detailBOnA.inverseInterpolateFraction(f0);
86
- const h1 = detailBOnA.inverseInterpolateFraction(f1);
88
+ const h0 = detailB0OnA.inverseInterpolateFraction(f0);
89
+ const h1 = detailB0OnA.inverseInterpolateFraction(f1);
87
90
  // recompute fractions and points..
88
- CoincidentGeometryQuery.assignDetailInterpolatedFractionsAndPoints(detailBOnA, f0, f1, pointA0, pointA1);
89
- CoincidentGeometryQuery.assignDetailInterpolatedFractionsAndPoints(detailAOnB, h0, h1, pointB0, pointB1);
90
- return CurveLocationDetailPair.createCapture(detailBOnA, detailAOnB);
91
+ CoincidentGeometryQuery.assignDetailInterpolatedFractionsAndPoints(detailB0OnA, f0, f1, pointA0, pointA1, f0 > f1);
92
+ CoincidentGeometryQuery.assignDetailInterpolatedFractionsAndPoints(detailA0OnB, h0, h1, pointB0, pointB1, h0 > h1);
93
+ return CurveLocationDetailPair.createCapture(detailB0OnA, detailA0OnB);
91
94
  }
92
95
  else {
93
96
  if (segment.signedDelta() < 0.0) {
94
- if (detailBOnA.point.isAlmostEqual(pointA0)) {
95
- detailBOnA.collapseToStart();
96
- detailAOnB.collapseToStart();
97
- return CurveLocationDetailPair.createCapture(detailBOnA, detailAOnB);
97
+ if (detailB0OnA.point.isAlmostEqual(pointA0, this.tolerance)) {
98
+ detailB0OnA.collapseToStart();
99
+ detailA0OnB.collapseToStart();
100
+ return CurveLocationDetailPair.createCapture(detailB0OnA, detailA0OnB);
98
101
  }
99
- if (detailBOnA.point1.isAlmostEqual(pointA1)) {
100
- detailBOnA.collapseToEnd();
101
- detailAOnB.collapseToEnd();
102
- return CurveLocationDetailPair.createCapture(detailBOnA, detailAOnB);
102
+ if (detailB0OnA.point1.isAlmostEqual(pointA1, this.tolerance)) {
103
+ detailB0OnA.collapseToEnd();
104
+ detailA0OnB.collapseToEnd();
105
+ return CurveLocationDetailPair.createCapture(detailB0OnA, detailA0OnB);
103
106
  }
104
107
  }
105
108
  else {
106
- if (detailBOnA.point.isAlmostEqual(pointA1)) {
107
- detailBOnA.collapseToStart();
108
- detailAOnB.collapseToEnd();
109
- return CurveLocationDetailPair.createCapture(detailBOnA, detailAOnB);
109
+ if (detailB0OnA.point.isAlmostEqual(pointA1, this.tolerance)) {
110
+ detailB0OnA.collapseToStart();
111
+ detailA0OnB.collapseToEnd();
112
+ return CurveLocationDetailPair.createCapture(detailB0OnA, detailA0OnB);
110
113
  }
111
- if (detailBOnA.point1.isAlmostEqual(pointA0)) {
112
- detailBOnA.collapseToEnd();
113
- detailAOnB.collapseToStart();
114
- return CurveLocationDetailPair.createCapture(detailBOnA, detailAOnB);
114
+ if (detailB0OnA.point1.isAlmostEqual(pointA0, this.tolerance)) {
115
+ detailB0OnA.collapseToEnd();
116
+ detailA0OnB.collapseToStart();
117
+ return CurveLocationDetailPair.createCapture(detailB0OnA, detailA0OnB);
115
118
  }
116
119
  }
117
120
  }
118
121
  return undefined;
119
122
  }
120
123
  /**
121
- * Create a CurveLocationDetailPair from . . .
124
+ * Create a CurveLocationDetailPair for a coincident interval of two overlapping curves
122
125
  * @param cpA curveA
123
- * @param cpB curve B
124
- * @param fractionsOnA fractions of an active section of curveA
125
- * @param fractionB0 fraction of an original containing B interval
126
- * @param fractionB1 end fraction of an original containing B interval
126
+ * @param cpB curveB
127
+ * @param fractionsOnA coincident interval of curveB in fraction space of curveA
128
+ * @param fractionB0 curveB start in fraction space of curveA
129
+ * @param fractionB1 curveB end in fraction space of curveA
130
+ * @param reverse whether curveB and curveA have opposite direction
127
131
  */
128
132
  createDetailPair(cpA, cpB, fractionsOnA, fractionB0, fractionB1, reverse) {
129
133
  const deltaB = fractionB1 - fractionB0;
@@ -132,10 +136,8 @@ export class CoincidentGeometryQuery {
132
136
  if (g0 !== undefined && g1 !== undefined) {
133
137
  const detailA = CurveLocationDetail.createCurveEvaluatedFractionFraction(cpA, fractionsOnA.x0, fractionsOnA.x1);
134
138
  const detailB = CurveLocationDetail.createCurveEvaluatedFractionFraction(cpB, g0, g1);
135
- if (reverse) {
139
+ if (reverse)
136
140
  detailA.swapFractionsAndPoints();
137
- detailB.swapFractionsAndPoints();
138
- }
139
141
  return CurveLocationDetailPair.createCapture(detailA, detailB);
140
142
  }
141
143
  return undefined;
@@ -153,11 +155,11 @@ export class CoincidentGeometryQuery {
153
155
  * @param arcA
154
156
  * @param arcB
155
157
  * @param _restrictToBounds
156
- * @return 0, 1, or 2 overlap intervals.
158
+ * @return 0, 1, or 2 overlap points/intervals
157
159
  */
158
160
  coincidentArcIntersectionXY(arcA, arcB, _restrictToBounds = true) {
159
161
  let result;
160
- if (arcA.center.isAlmostEqual(arcB.center)) {
162
+ if (arcA.center.isAlmostEqual(arcB.center, this.tolerance)) {
161
163
  const matrixBToA = arcA.matrixRef.multiplyMatrixInverseMatrix(arcB.matrixRef);
162
164
  if (matrixBToA) {
163
165
  const ux = matrixBToA.at(0, 0);
@@ -171,25 +173,49 @@ export class CoincidentGeometryQuery {
171
173
  if (Geometry.isAlmostEqualNumber(ru, 1.0)
172
174
  && Geometry.isAlmostEqualNumber(rv, 1.0)
173
175
  && Geometry.isAlmostEqualNumber(0, dot)) {
174
- const alphaB0Radians = Math.atan2(uy, ux); // angular position of arcB 0 point in A sweep
175
- const sweepDirection = cross > 0 ? 1.0 : -1.0; // 1 if arcB's parameter space sweeps forward, -1 if reverse
176
- const betaStartRadians = alphaB0Radians + sweepDirection * arcB.sweep.startRadians;
177
- const betaEndRadians = alphaB0Radians + sweepDirection * arcB.sweep.endRadians;
176
+ const alphaB0Radians = Math.atan2(uy, ux); // angular position of arcB 0 point in arcA sweep
177
+ const sweepDirection = cross > 0 ? 1.0 : -1.0; // 1 if arcB parameter space sweeps in same direction as arcA, -1 if opposite
178
+ const betaStartRadians = alphaB0Radians + sweepDirection * arcB.sweep.startRadians; // arcB start in arcA parameter space
179
+ const betaEndRadians = alphaB0Radians + sweepDirection * arcB.sweep.endRadians; // arcB end in arcA parameter space
178
180
  const fractionSpacesReversed = (sweepDirection * arcA.sweep.sweepRadians * arcB.sweep.sweepRadians) < 0;
179
181
  const sweepB = AngleSweep.createStartEndRadians(betaStartRadians, betaEndRadians);
180
182
  const sweepA = arcA.sweep;
181
183
  const fractionPeriodA = sweepA.fractionPeriod();
182
- const fractionB0 = sweepA.radiansToPositivePeriodicFraction(sweepB.startRadians);
183
- const fractionSweep = sweepB.sweepRadians / sweepA.sweepRadians;
184
- const fractionB1 = fractionB0 + fractionSweep;
184
+ const fractionB0 = sweepA.radiansToPositivePeriodicFraction(sweepB.startRadians); // arcB start in arcA fraction space
185
+ assert(fractionB0 >= 0.0);
186
+ const fractionSweep = sweepB.sweepRadians / sweepA.sweepRadians; // arcB sweep in arcA fraction space
187
+ const fractionB1 = fractionB0 + fractionSweep; // arcB end in arcA fraction space
185
188
  const fractionSweepB = Segment1d.create(fractionB0, fractionB1);
186
- if (fractionSweepB.clampDirectedTo01())
187
- result = this.appendDetailPair(result, this.createDetailPair(arcA, arcB, fractionSweepB, fractionB0, fractionB1, fractionSpacesReversed));
188
- if (fractionB1 > fractionPeriodA) {
189
- const fractionSweepBWrap = Segment1d.create(fractionB0 - fractionPeriodA, fractionB1 - fractionPeriodA);
190
- if (fractionSweepBWrap.clampDirectedTo01())
191
- result = this.appendDetailPair(result, this.createDetailPair(arcA, arcB, fractionSweepBWrap, fractionB0, fractionB1, fractionSpacesReversed));
192
- }
189
+ /** lambda to add a coincident interval or isolated intersection, given inputs in arcA fraction space
190
+ * @param arcBInArcAFractionSpace span of arcB in arcA fraction space. On return, clamped to [0,1] if nontrivial.
191
+ * @param testStartOfArcA if no nontrivial coincident interval was found, look for an isolated intersection at the start (true) or end (false) of arcA
192
+ * @returns whether a detail pair was appended to result
193
+ */
194
+ const appendCoincidentIntersection = (arcBInArcAFractionSpace, testStartOfArcA) => {
195
+ const size = result ? result.length : 0;
196
+ const arcBStart = arcBInArcAFractionSpace.x0;
197
+ const arcBEnd = arcBInArcAFractionSpace.x1;
198
+ if (arcBInArcAFractionSpace.clampDirectedTo01() && !Geometry.isSmallRelative(arcBInArcAFractionSpace.absoluteDelta())) {
199
+ result = this.appendDetailPair(result, this.createDetailPair(arcA, arcB, arcBInArcAFractionSpace, arcBStart, arcBEnd, fractionSpacesReversed));
200
+ }
201
+ else { // test isolated intersection
202
+ const testStartOfArcB = fractionSpacesReversed ? testStartOfArcA : !testStartOfArcA;
203
+ const arcAPt = this._point0 = testStartOfArcA ? arcA.startPoint(this._point0) : arcA.endPoint(this._point0);
204
+ const arcBPt = this._point1 = testStartOfArcB ? arcB.startPoint(this._point1) : arcB.endPoint(this._point1);
205
+ if (arcAPt.isAlmostEqual(arcBPt, this.tolerance)) {
206
+ const detailA = CurveLocationDetail.createCurveFractionPoint(arcA, testStartOfArcA ? 0 : 1, arcAPt);
207
+ const detailB = CurveLocationDetail.createCurveFractionPoint(arcB, testStartOfArcB ? 0 : 1, arcBPt);
208
+ result = this.appendDetailPair(result, CurveLocationDetailPair.createCapture(detailA, detailB));
209
+ }
210
+ }
211
+ return result !== undefined && result.length > size;
212
+ };
213
+ appendCoincidentIntersection(fractionSweepB, false); // compute overlap in strict interior, or at end of arcA
214
+ // check overlap at start of arcA with a periodic shift of fractionSweepB
215
+ if (fractionB1 >= fractionPeriodA)
216
+ appendCoincidentIntersection(Segment1d.create(fractionB0 - fractionPeriodA, fractionB1 - fractionPeriodA), true);
217
+ else if (fractionB0 === 0.0)
218
+ appendCoincidentIntersection(Segment1d.create(fractionB0 + fractionPeriodA, fractionB1 + fractionPeriodA), true);
193
219
  }
194
220
  }
195
221
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CoincidentGeometryOps.js","sourceRoot":"","sources":["../../../src/geometry3d/CoincidentGeometry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B,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,kBAAkB,EAAE,UAAU,EAAE,UAAU,EAAE,sBAAsB,CAAC,CAAC,CAAC;qBACjJ;iBACF;aACF;SACF;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","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 CartesianGeometry\r\n */\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { CurveLocationDetail, CurveLocationDetailPair } from \"../curve/CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { AngleSweep } from \"./AngleSweep\";\r\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\r\nimport { Segment1d } from \"./Segment1d\";\r\n\r\n/**\r\n * `CoincidentGeometryQuery` has methods useful in testing for overlapping geometry.\r\n * * Each instance carries tolerance information that can be reused over extended call sequences.\r\n * * These methods are expected to be called internally by CurveCurve intersection methods.\r\n * @internal\r\n */\r\nexport class CoincidentGeometryQuery {\r\n private _vectorU?: Vector3d;\r\n private _vectorV?: Vector3d;\r\n private _tolerance: number;\r\n public get tolerance(): number {\r\n return this._tolerance;\r\n }\r\n private constructor(tolerance: number = Geometry.smallMetricDistance) {\r\n this._tolerance = tolerance;\r\n }\r\n public static create(tolerance: number = Geometry.smallMetricDistance): CoincidentGeometryQuery {\r\n return new CoincidentGeometryQuery(tolerance);\r\n }\r\n /**\r\n * * Assign both the fraction and fraction1 values in the detail, possibly swapped.\r\n * * reevaluate the points as simple interpolation between given points.\r\n */\r\n public static assignDetailInterpolatedFractionsAndPoints(detail: CurveLocationDetail, f0: number, f1: number,\r\n pointA: Point3d, pointB: Point3d, swap: boolean = false) {\r\n if (swap) {\r\n detail.fraction = f1;\r\n detail.fraction1 = f0;\r\n } else {\r\n detail.fraction = f0;\r\n detail.fraction1 = f1;\r\n }\r\n detail.point = pointA.interpolate(detail.fraction, pointB, detail.point);\r\n detail.point1 = pointA.interpolate(detail.fraction1, pointB, detail.point1);\r\n\r\n }\r\n\r\n /** Return a curve location detail with projection of a `spacePoint` to the line segment with `pointA` and `pointB`\r\n *\r\n */\r\n public projectPointToSegmentXY(spacePoint: Point3d, pointA: Point3d, pointB: Point3d): CurveLocationDetail {\r\n this._vectorU = Vector3d.createStartEnd(pointA, pointB, this._vectorU);\r\n this._vectorV = Vector3d.createStartEnd(pointA, spacePoint, this._vectorV);\r\n const uDotU = this._vectorU.dotProductXY(this._vectorU);\r\n const uDotV = this._vectorU.dotProductXY(this._vectorV);\r\n const fraction = Geometry.safeDivideFraction(uDotV, uDotU, 0.0);\r\n return CurveLocationDetail.createCurveFractionPoint(undefined, fraction,\r\n pointA.interpolate(fraction, pointB));\r\n }\r\n /**\r\n * * project `pointA0` and `pointA1` onto the segment with `pointB0` and `pointB1`\r\n * * In the returned detail pair, the `detailA` has fractions along segmentA, and `detailB` has fractions along segment B\r\n * @param pointA0 start point of segment A\r\n * @param pointA1 end point of segment A\r\n * @param pointB0 start point of segment B\r\n * @param pointB1 end point of segment B\r\n */\r\n public coincidentSegmentRangeXY(pointA0: Point3d, pointA1: Point3d, pointB0: Point3d, pointB1: Point3d, restrictToBounds: boolean = true): CurveLocationDetailPair | undefined {\r\n const detailAOnB = this.projectPointToSegmentXY(pointA0, pointB0, pointB1);\r\n if (pointA0.distanceXY(detailAOnB.point) > this._tolerance)\r\n return undefined;\r\n const detailA1OnB = this.projectPointToSegmentXY(pointA1, pointB0, pointB1);\r\n if (pointA1.distanceXY(detailA1OnB.point) > this._tolerance)\r\n return undefined;\r\n\r\n const detailBOnA = this.projectPointToSegmentXY(pointB0, pointA0, pointA1);\r\n if (pointB0.distanceXY(detailBOnA.point) > this._tolerance)\r\n return undefined;\r\n const detailB1OnA = this.projectPointToSegmentXY(pointB1, pointA0, pointA1);\r\n if (pointB1.distanceXY(detailB1OnA.point) > this._tolerance)\r\n return undefined;\r\n\r\n detailAOnB.fraction1 = detailA1OnB.fraction;\r\n detailAOnB.point1 = detailA1OnB.point; // capture -- detailB0OnA is not reused.\r\n detailBOnA.fraction1 = detailB1OnA.fraction;\r\n detailBOnA.point1 = detailB1OnA.point;\r\n if (!restrictToBounds)\r\n return CurveLocationDetailPair.createCapture(detailBOnA, detailAOnB);\r\n\r\n const segment = Segment1d.create(detailBOnA.fraction, detailBOnA.fraction1);\r\n if (segment.clampDirectedTo01()) {\r\n segment.reverseIfNeededForDeltaSign(1.0);\r\n const f0 = segment.x0;\r\n const f1 = segment.x1;\r\n const h0 = detailBOnA.inverseInterpolateFraction(f0);\r\n const h1 = detailBOnA.inverseInterpolateFraction(f1);\r\n // recompute fractions and points..\r\n CoincidentGeometryQuery.assignDetailInterpolatedFractionsAndPoints(detailBOnA, f0, f1, pointA0, pointA1);\r\n CoincidentGeometryQuery.assignDetailInterpolatedFractionsAndPoints(detailAOnB, h0, h1, pointB0, pointB1);\r\n return CurveLocationDetailPair.createCapture(detailBOnA, detailAOnB);\r\n } else {\r\n if (segment.signedDelta() < 0.0) {\r\n if (detailBOnA.point.isAlmostEqual(pointA0)) {\r\n detailBOnA.collapseToStart();\r\n detailAOnB.collapseToStart();\r\n return CurveLocationDetailPair.createCapture(detailBOnA, detailAOnB);\r\n }\r\n if (detailBOnA.point1.isAlmostEqual(pointA1)) {\r\n detailBOnA.collapseToEnd();\r\n detailAOnB.collapseToEnd();\r\n return CurveLocationDetailPair.createCapture(detailBOnA, detailAOnB);\r\n }\r\n } else {\r\n if (detailBOnA.point.isAlmostEqual(pointA1)) {\r\n detailBOnA.collapseToStart();\r\n detailAOnB.collapseToEnd();\r\n return CurveLocationDetailPair.createCapture(detailBOnA, detailAOnB);\r\n }\r\n if (detailBOnA.point1.isAlmostEqual(pointA0)) {\r\n detailBOnA.collapseToEnd();\r\n detailAOnB.collapseToStart();\r\n return CurveLocationDetailPair.createCapture(detailBOnA, detailAOnB);\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Create a CurveLocationDetailPair from . . .\r\n * @param cpA curveA\r\n * @param cpB curve B\r\n * @param fractionsOnA fractions of an active section of curveA\r\n * @param fractionB0 fraction of an original containing B interval\r\n * @param fractionB1 end fraction of an original containing B interval\r\n */\r\n private createDetailPair(cpA: CurvePrimitive, cpB: CurvePrimitive, fractionsOnA: Segment1d, fractionB0: number, fractionB1: number, reverse: boolean): CurveLocationDetailPair | undefined {\r\n const deltaB = fractionB1 - fractionB0;\r\n const g0 = Geometry.conditionalDivideFraction(fractionsOnA.x0 - fractionB0, deltaB);\r\n const g1 = Geometry.conditionalDivideFraction(fractionsOnA.x1 - fractionB0, deltaB);\r\n if (g0 !== undefined && g1 !== undefined) {\r\n const detailA = CurveLocationDetail.createCurveEvaluatedFractionFraction(cpA, fractionsOnA.x0, fractionsOnA.x1);\r\n const detailB = CurveLocationDetail.createCurveEvaluatedFractionFraction(cpB, g0, g1);\r\n if (reverse) {\r\n detailA.swapFractionsAndPoints();\r\n detailB.swapFractionsAndPoints();\r\n }\r\n return CurveLocationDetailPair.createCapture(detailA, detailB);\r\n }\r\n return undefined;\r\n }\r\n private appendDetailPair(result: CurveLocationDetailPair[] | undefined, pair: CurveLocationDetailPair | undefined): CurveLocationDetailPair[] | undefined {\r\n if (pair === undefined)\r\n return result;\r\n if (result === undefined)\r\n return [pair];\r\n result.push(pair);\r\n return result;\r\n }\r\n /**\r\n * Test if 2 arcs have coinciding portions.\r\n * @param arcA\r\n * @param arcB\r\n * @param _restrictToBounds\r\n * @return 0, 1, or 2 overlap intervals.\r\n */\r\n public coincidentArcIntersectionXY(arcA: Arc3d, arcB: Arc3d, _restrictToBounds: boolean = true): CurveLocationDetailPair[] | undefined {\r\n let result: CurveLocationDetailPair[] | undefined;\r\n if (arcA.center.isAlmostEqual(arcB.center)) {\r\n const matrixBToA = arcA.matrixRef.multiplyMatrixInverseMatrix(arcB.matrixRef);\r\n if (matrixBToA) {\r\n const ux = matrixBToA.at(0, 0); const uy = matrixBToA.at(1, 0);\r\n const vx = matrixBToA.at(0, 1); const vy = matrixBToA.at(1, 1);\r\n const ru = Geometry.hypotenuseXY(ux, uy);\r\n const rv = Geometry.hypotenuseXY(vx, vy);\r\n const dot = Geometry.dotProductXYXY(ux, uy, vx, vy);\r\n const cross = Geometry.crossProductXYXY(ux, uy, vx, vy);\r\n if (Geometry.isAlmostEqualNumber(ru, 1.0)\r\n && Geometry.isAlmostEqualNumber(rv, 1.0)\r\n && Geometry.isAlmostEqualNumber(0, dot)) {\r\n const alphaB0Radians = Math.atan2(uy, ux); // angular position of arcB 0 point in A sweep\r\n const sweepDirection = cross > 0 ? 1.0 : -1.0; // 1 if arcB's parameter space sweeps forward, -1 if reverse\r\n const betaStartRadians = alphaB0Radians + sweepDirection * arcB.sweep.startRadians;\r\n const betaEndRadians = alphaB0Radians + sweepDirection * arcB.sweep.endRadians;\r\n const fractionSpacesReversed = (sweepDirection * arcA.sweep.sweepRadians * arcB.sweep.sweepRadians) < 0;\r\n const sweepB = AngleSweep.createStartEndRadians(betaStartRadians, betaEndRadians);\r\n const sweepA = arcA.sweep;\r\n const fractionPeriodA = sweepA.fractionPeriod();\r\n const fractionB0 = sweepA.radiansToPositivePeriodicFraction(sweepB.startRadians);\r\n const fractionSweep = sweepB.sweepRadians / sweepA.sweepRadians;\r\n const fractionB1 = fractionB0 + fractionSweep;\r\n const fractionSweepB = Segment1d.create(fractionB0, fractionB1);\r\n if (fractionSweepB.clampDirectedTo01())\r\n result = this.appendDetailPair(result, this.createDetailPair(arcA, arcB, fractionSweepB, fractionB0, fractionB1, fractionSpacesReversed));\r\n if (fractionB1 > fractionPeriodA) {\r\n const fractionSweepBWrap = Segment1d.create(fractionB0 - fractionPeriodA, fractionB1 - fractionPeriodA);\r\n if (fractionSweepBWrap.clampDirectedTo01())\r\n result = this.appendDetailPair(result, this.createDetailPair(arcA, arcB, fractionSweepBWrap, fractionB0, fractionB1, fractionSpacesReversed));\r\n }\r\n }\r\n }\r\n }\r\n return result;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"CoincidentGeometryOps.js","sourceRoot":"","sources":["../../../src/geometry3d/CoincidentGeometryOps.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAE5F,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAW,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;;GAKG;AACH,MAAM,OAAO,uBAAuB;IAMlC,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IACD,YAAoB,YAAoB,QAAQ,CAAC,mBAAmB;QAClE,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;IACM,MAAM,CAAC,MAAM,CAAC,YAAoB,QAAQ,CAAC,mBAAmB;QACnE,OAAO,IAAI,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAChD,CAAC;IACD;;;OAGG;IACI,MAAM,CAAC,0CAA0C,CAAC,MAA2B,EAAE,EAAU,EAAE,EAAU,EAC1G,MAAe,EAAE,MAAe,EAAE,OAAgB,KAAK;QACvD,IAAI,IAAI,EAAE;YACR,MAAM,CAAC,QAAQ,GAAG,EAAE,CAAC;YACrB,MAAM,CAAC,SAAS,GAAG,EAAE,CAAC;SACvB;aAAM;YACL,MAAM,CAAC,QAAQ,GAAG,EAAE,CAAC;YACrB,MAAM,CAAC,SAAS,GAAG,EAAE,CA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GAAG,mBAAmB,CAAC,wBAAwB,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;gCACpG,MAAM,OAAO,GAAG,mBAAmB,CAAC,wBAAwB,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;gCACpG,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,uBAAuB,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;6BACjG;yBACF;wBACD,OAAO,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC;oBACtD,CAAC,CAAC;oBAEF,4BAA4B,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC,CAAE,wDAAwD;oBAE9G,yEAAyE;oBACzE,IAAI,UAAU,IAAI,eAAe;wBAC/B,4BAA4B,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,GAAG,eAAe,EAAE,UAAU,GAAG,eAAe,CAAC,EAAE,IAAI,CAAC,CAAC;yBAC9G,IAAI,UAAU,KAAK,GAAG;wBACzB,4BAA4B,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,GAAG,eAAe,EAAE,UAAU,GAAG,eAAe,CAAC,EAAE,IAAI,CAAC,CAAC;iBACpH;aACF;SACF;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module CartesianGeometry\n */\nimport { assert } from \"@itwin/core-bentley\";\nimport { Arc3d } from \"../curve/Arc3d\";\nimport { CurveLocationDetail, CurveLocationDetailPair } from \"../curve/CurveLocationDetail\";\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\nimport { Geometry } from \"../Geometry\";\nimport { AngleSweep } from \"./AngleSweep\";\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\nimport { Segment1d } from \"./Segment1d\";\n\n/**\n * `CoincidentGeometryQuery` has methods useful in testing for overlapping geometry.\n * * Each instance carries tolerance information that can be reused over extended call sequences.\n * * These methods are expected to be called internally by CurveCurve intersection methods.\n * @internal\n */\nexport class CoincidentGeometryQuery {\n private _vectorU?: Vector3d;\n private _vectorV?: Vector3d;\n private _point0?: Point3d;\n private _point1?: Point3d;\n private _tolerance: number;\n public get tolerance(): number {\n return this._tolerance;\n }\n private constructor(tolerance: number = Geometry.smallMetricDistance) {\n this._tolerance = tolerance;\n }\n public static create(tolerance: number = Geometry.smallMetricDistance): CoincidentGeometryQuery {\n return new CoincidentGeometryQuery(tolerance);\n }\n /**\n * * Assign both the fraction and fraction1 values in the detail, possibly swapped.\n * * reevaluate the points as simple interpolation between given points.\n */\n public static assignDetailInterpolatedFractionsAndPoints(detail: CurveLocationDetail, f0: number, f1: number,\n pointA: Point3d, pointB: Point3d, swap: boolean = false) {\n if (swap) {\n detail.fraction = f1;\n detail.fraction1 = f0;\n } else {\n detail.fraction = f0;\n detail.fraction1 = f1;\n }\n detail.point = pointA.interpolate(detail.fraction, pointB, detail.point);\n detail.point1 = pointA.interpolate(detail.fraction1, pointB, detail.point1);\n\n }\n\n /** Return a curve location detail with projection of a `spacePoint` to the line segment with `pointA` and `pointB`\n *\n */\n public projectPointToSegmentXY(spacePoint: Point3d, pointA: Point3d, pointB: Point3d): CurveLocationDetail {\n this._vectorU = Vector3d.createStartEnd(pointA, pointB, this._vectorU);\n this._vectorV = Vector3d.createStartEnd(pointA, spacePoint, this._vectorV);\n const uDotU = this._vectorU.dotProductXY(this._vectorU);\n const uDotV = this._vectorU.dotProductXY(this._vectorV);\n const fraction = Geometry.safeDivideFraction(uDotV, uDotU, 0.0);\n return CurveLocationDetail.createCurveFractionPoint(undefined, fraction,\n pointA.interpolate(fraction, pointB));\n }\n /**\n * * project `pointA0` and `pointA1` onto the segment with `pointB0` and `pointB1`\n * * In the returned detail pair, the `detailA` has fractions along segmentA, and `detailB` has fractions along segment B\n * @param pointA0 start point of segment A\n * @param pointA1 end point of segment A\n * @param pointB0 start point of segment B\n * @param pointB1 end point of segment B\n */\n public coincidentSegmentRangeXY(pointA0: Point3d, pointA1: Point3d, pointB0: Point3d, pointB1: Point3d, restrictToBounds: boolean = true): CurveLocationDetailPair | undefined {\n const detailA0OnB = this.projectPointToSegmentXY(pointA0, pointB0, pointB1);\n if (pointA0.distanceXY(detailA0OnB.point) > this._tolerance)\n return undefined;\n const detailA1OnB = this.projectPointToSegmentXY(pointA1, pointB0, pointB1);\n if (pointA1.distanceXY(detailA1OnB.point) > this._tolerance)\n return undefined;\n\n const detailB0OnA = this.projectPointToSegmentXY(pointB0, pointA0, pointA1);\n if (pointB0.distanceXY(detailB0OnA.point) > this._tolerance)\n return undefined;\n const detailB1OnA = this.projectPointToSegmentXY(pointB1, pointA0, pointA1);\n if (pointB1.distanceXY(detailB1OnA.point) > this._tolerance)\n return undefined;\n\n detailA0OnB.fraction1 = detailA1OnB.fraction;\n detailA0OnB.point1 = detailA1OnB.point; // capture -- detailA1OnB is not reused.\n detailB0OnA.fraction1 = detailB1OnA.fraction;\n detailB0OnA.point1 = detailB1OnA.point;\n if (!restrictToBounds)\n return CurveLocationDetailPair.createCapture(detailB0OnA, detailA0OnB);\n\n const segment = Segment1d.create(detailB0OnA.fraction, detailB0OnA.fraction1);\n if (segment.clampDirectedTo01()) {\n const f0 = segment.x0;\n const f1 = segment.x1;\n const h0 = detailB0OnA.inverseInterpolateFraction(f0);\n const h1 = detailB0OnA.inverseInterpolateFraction(f1);\n // recompute fractions and points..\n CoincidentGeometryQuery.assignDetailInterpolatedFractionsAndPoints(detailB0OnA, f0, f1, pointA0, pointA1, f0 > f1);\n CoincidentGeometryQuery.assignDetailInterpolatedFractionsAndPoints(detailA0OnB, h0, h1, pointB0, pointB1, h0 > h1);\n return CurveLocationDetailPair.createCapture(detailB0OnA, detailA0OnB);\n } else {\n if (segment.signedDelta() < 0.0) {\n if (detailB0OnA.point.isAlmostEqual(pointA0, this.tolerance)) {\n detailB0OnA.collapseToStart();\n detailA0OnB.collapseToStart();\n return CurveLocationDetailPair.createCapture(detailB0OnA, detailA0OnB);\n }\n if (detailB0OnA.point1.isAlmostEqual(pointA1, this.tolerance)) {\n detailB0OnA.collapseToEnd();\n detailA0OnB.collapseToEnd();\n return CurveLocationDetailPair.createCapture(detailB0OnA, detailA0OnB);\n }\n } else {\n if (detailB0OnA.point.isAlmostEqual(pointA1, this.tolerance)) {\n detailB0OnA.collapseToStart();\n detailA0OnB.collapseToEnd();\n return CurveLocationDetailPair.createCapture(detailB0OnA, detailA0OnB);\n }\n if (detailB0OnA.point1.isAlmostEqual(pointA0, this.tolerance)) {\n detailB0OnA.collapseToEnd();\n detailA0OnB.collapseToStart();\n return CurveLocationDetailPair.createCapture(detailB0OnA, detailA0OnB);\n }\n }\n }\n return undefined;\n }\n /**\n * Create a CurveLocationDetailPair for a coincident interval of two overlapping curves\n * @param cpA curveA\n * @param cpB curveB\n * @param fractionsOnA coincident interval of curveB in fraction space of curveA\n * @param fractionB0 curveB start in fraction space of curveA\n * @param fractionB1 curveB end in fraction space of curveA\n * @param reverse whether curveB and curveA have opposite direction\n */\n private createDetailPair(cpA: CurvePrimitive, cpB: CurvePrimitive, fractionsOnA: Segment1d, fractionB0: number, fractionB1: number, reverse: boolean): CurveLocationDetailPair | undefined {\n const deltaB = fractionB1 - fractionB0;\n const g0 = Geometry.conditionalDivideFraction(fractionsOnA.x0 - fractionB0, deltaB);\n const g1 = Geometry.conditionalDivideFraction(fractionsOnA.x1 - fractionB0, deltaB);\n if (g0 !== undefined && g1 !== undefined) {\n const detailA = CurveLocationDetail.createCurveEvaluatedFractionFraction(cpA, fractionsOnA.x0, fractionsOnA.x1);\n const detailB = CurveLocationDetail.createCurveEvaluatedFractionFraction(cpB, g0, g1);\n if (reverse)\n detailA.swapFractionsAndPoints();\n return CurveLocationDetailPair.createCapture(detailA, detailB);\n }\n return undefined;\n }\n private appendDetailPair(result: CurveLocationDetailPair[] | undefined, pair: CurveLocationDetailPair | undefined): CurveLocationDetailPair[] | undefined {\n if (pair === undefined)\n return result;\n if (result === undefined)\n return [pair];\n result.push(pair);\n return result;\n }\n /**\n * Test if 2 arcs have coinciding portions.\n * @param arcA\n * @param arcB\n * @param _restrictToBounds\n * @return 0, 1, or 2 overlap points/intervals\n */\n public coincidentArcIntersectionXY(arcA: Arc3d, arcB: Arc3d, _restrictToBounds: boolean = true): CurveLocationDetailPair[] | undefined {\n let result: CurveLocationDetailPair[] | undefined;\n if (arcA.center.isAlmostEqual(arcB.center, this.tolerance)) {\n const matrixBToA = arcA.matrixRef.multiplyMatrixInverseMatrix(arcB.matrixRef);\n if (matrixBToA) {\n const ux = matrixBToA.at(0, 0); const uy = matrixBToA.at(1, 0);\n const vx = matrixBToA.at(0, 1); const vy = matrixBToA.at(1, 1);\n const ru = Geometry.hypotenuseXY(ux, uy);\n const rv = Geometry.hypotenuseXY(vx, vy);\n const dot = Geometry.dotProductXYXY(ux, uy, vx, vy);\n const cross = Geometry.crossProductXYXY(ux, uy, vx, vy);\n if (Geometry.isAlmostEqualNumber(ru, 1.0)\n && Geometry.isAlmostEqualNumber(rv, 1.0)\n && Geometry.isAlmostEqualNumber(0, dot)) {\n const alphaB0Radians = Math.atan2(uy, ux); // angular position of arcB 0 point in arcA sweep\n const sweepDirection = cross > 0 ? 1.0 : -1.0; // 1 if arcB parameter space sweeps in same direction as arcA, -1 if opposite\n const betaStartRadians = alphaB0Radians + sweepDirection * arcB.sweep.startRadians; // arcB start in arcA parameter space\n const betaEndRadians = alphaB0Radians + sweepDirection * arcB.sweep.endRadians; // arcB end in arcA parameter space\n const fractionSpacesReversed = (sweepDirection * arcA.sweep.sweepRadians * arcB.sweep.sweepRadians) < 0;\n const sweepB = AngleSweep.createStartEndRadians(betaStartRadians, betaEndRadians);\n const sweepA = arcA.sweep;\n const fractionPeriodA = sweepA.fractionPeriod();\n const fractionB0 = sweepA.radiansToPositivePeriodicFraction(sweepB.startRadians); // arcB start in arcA fraction space\n assert(fractionB0 >= 0.0);\n const fractionSweep = sweepB.sweepRadians / sweepA.sweepRadians; // arcB sweep in arcA fraction space\n const fractionB1 = fractionB0 + fractionSweep; // arcB end in arcA fraction space\n const fractionSweepB = Segment1d.create(fractionB0, fractionB1);\n\n /** lambda to add a coincident interval or isolated intersection, given inputs in arcA fraction space\n * @param arcBInArcAFractionSpace span of arcB in arcA fraction space. On return, clamped to [0,1] if nontrivial.\n * @param testStartOfArcA if no nontrivial coincident interval was found, look for an isolated intersection at the start (true) or end (false) of arcA\n * @returns whether a detail pair was appended to result\n */\n const appendCoincidentIntersection = (arcBInArcAFractionSpace: Segment1d, testStartOfArcA: boolean): boolean => {\n const size = result ? result.length : 0;\n const arcBStart = arcBInArcAFractionSpace.x0;\n const arcBEnd = arcBInArcAFractionSpace.x1;\n if (arcBInArcAFractionSpace.clampDirectedTo01() && !Geometry.isSmallRelative(arcBInArcAFractionSpace.absoluteDelta())) {\n result = this.appendDetailPair(result, this.createDetailPair(arcA, arcB, arcBInArcAFractionSpace, arcBStart, arcBEnd, fractionSpacesReversed));\n } else { // test isolated intersection\n const testStartOfArcB = fractionSpacesReversed ? testStartOfArcA : !testStartOfArcA;\n const arcAPt = this._point0 = testStartOfArcA ? arcA.startPoint(this._point0): arcA.endPoint(this._point0);\n const arcBPt = this._point1 = testStartOfArcB ? arcB.startPoint(this._point1): arcB.endPoint(this._point1);\n if (arcAPt.isAlmostEqual(arcBPt, this.tolerance)) {\n const detailA = CurveLocationDetail.createCurveFractionPoint(arcA, testStartOfArcA ? 0 : 1, arcAPt);\n const detailB = CurveLocationDetail.createCurveFractionPoint(arcB, testStartOfArcB ? 0 : 1, arcBPt);\n result = this.appendDetailPair(result, CurveLocationDetailPair.createCapture(detailA, detailB));\n }\n }\n return result !== undefined && result.length > size;\n };\n\n appendCoincidentIntersection(fractionSweepB, false); // compute overlap in strict interior, or at end of arcA\n\n // check overlap at start of arcA with a periodic shift of fractionSweepB\n if (fractionB1 >= fractionPeriodA)\n appendCoincidentIntersection(Segment1d.create(fractionB0 - fractionPeriodA, fractionB1 - fractionPeriodA), true);\n else if (fractionB0 === 0.0)\n appendCoincidentIntersection(Segment1d.create(fractionB0 + fractionPeriodA, fractionB1 + fractionPeriodA), true);\n }\n }\n }\n return result;\n }\n}\n"]}