@itwin/core-geometry 5.1.0-dev.9 → 5.2.0-dev.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 (598) hide show
  1. package/CHANGELOG.md +63 -1
  2. package/lib/cjs/Geometry.d.ts +18 -10
  3. package/lib/cjs/Geometry.d.ts.map +1 -1
  4. package/lib/cjs/Geometry.js +13 -3
  5. package/lib/cjs/Geometry.js.map +1 -1
  6. package/lib/cjs/bspline/BSpline1dNd.d.ts +1 -1
  7. package/lib/cjs/bspline/BSpline1dNd.js +1 -1
  8. package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
  9. package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
  10. package/lib/cjs/bspline/BSplineCurve.js +7 -1
  11. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  12. package/lib/cjs/bspline/BSplineSurface.d.ts +4 -3
  13. package/lib/cjs/bspline/BSplineSurface.d.ts.map +1 -1
  14. package/lib/cjs/bspline/BSplineSurface.js +4 -5
  15. package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
  16. package/lib/cjs/clipping/ClipPlane.d.ts +7 -5
  17. package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
  18. package/lib/cjs/clipping/ClipPlane.js +9 -5
  19. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  20. package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
  21. package/lib/cjs/clipping/ClipUtils.js +5 -3
  22. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  23. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +1 -2
  24. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  25. package/lib/cjs/clipping/ConvexClipPlaneSet.js +13 -25
  26. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  27. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts +1 -2
  28. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  29. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js +1 -2
  30. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  31. package/lib/cjs/core-geometry.d.ts +2 -0
  32. package/lib/cjs/core-geometry.d.ts.map +1 -1
  33. package/lib/cjs/core-geometry.js +2 -0
  34. package/lib/cjs/core-geometry.js.map +1 -1
  35. package/lib/cjs/curve/Arc3d.d.ts +54 -32
  36. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  37. package/lib/cjs/curve/Arc3d.js +56 -37
  38. package/lib/cjs/curve/Arc3d.js.map +1 -1
  39. package/lib/cjs/curve/CurveCollection.d.ts +40 -1
  40. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  41. package/lib/cjs/curve/CurveCollection.js +90 -0
  42. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  43. package/lib/cjs/curve/CurveFactory.d.ts +3 -2
  44. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  45. package/lib/cjs/curve/CurveFactory.js +6 -5
  46. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  47. package/lib/cjs/curve/CurveLocationDetail.d.ts +27 -25
  48. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  49. package/lib/cjs/curve/CurveLocationDetail.js +30 -25
  50. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  51. package/lib/cjs/curve/CurvePrimitive.d.ts +9 -2
  52. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  53. package/lib/cjs/curve/CurvePrimitive.js +11 -0
  54. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  55. package/lib/cjs/curve/CurveTypes.d.ts +1 -1
  56. package/lib/cjs/curve/CurveTypes.js.map +1 -1
  57. package/lib/cjs/curve/LineSegment3d.d.ts +2 -0
  58. package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
  59. package/lib/cjs/curve/LineSegment3d.js +4 -0
  60. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  61. package/lib/cjs/curve/LineString3d.d.ts +7 -0
  62. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  63. package/lib/cjs/curve/LineString3d.js +15 -3
  64. package/lib/cjs/curve/LineString3d.js.map +1 -1
  65. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
  66. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js +37 -8
  67. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  68. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +34 -8
  69. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  70. package/lib/cjs/curve/Query/PlanarSubdivision.js +129 -33
  71. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  72. package/lib/cjs/curve/Query/StrokeCountChain.d.ts +4 -3
  73. package/lib/cjs/curve/Query/StrokeCountChain.d.ts.map +1 -1
  74. package/lib/cjs/curve/Query/StrokeCountChain.js +20 -9
  75. package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
  76. package/lib/cjs/curve/RegionMomentsXY.d.ts +2 -1
  77. package/lib/cjs/curve/RegionMomentsXY.d.ts.map +1 -1
  78. package/lib/cjs/curve/RegionMomentsXY.js +26 -41
  79. package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
  80. package/lib/cjs/curve/RegionOps.d.ts +74 -39
  81. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  82. package/lib/cjs/curve/RegionOps.js +146 -46
  83. package/lib/cjs/curve/RegionOps.js.map +1 -1
  84. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts +36 -27
  85. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  86. package/lib/cjs/curve/RegionOpsClassificationSweeps.js +161 -55
  87. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  88. package/lib/cjs/curve/StrokeOptions.d.ts +1 -1
  89. package/lib/cjs/curve/StrokeOptions.js +1 -1
  90. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  91. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  92. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +2 -2
  93. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +6 -6
  94. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  95. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +0 -1
  96. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  97. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +58 -32
  98. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  99. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  100. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +0 -1
  101. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  102. package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.d.ts +14 -0
  103. package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.d.ts.map +1 -0
  104. package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.js +34 -0
  105. package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.js.map +1 -0
  106. package/lib/cjs/geometry3d/AngleSweep.d.ts +25 -18
  107. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  108. package/lib/cjs/geometry3d/AngleSweep.js +32 -18
  109. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  110. package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts +8 -7
  111. package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
  112. package/lib/cjs/geometry3d/CoincidentGeometryOps.js +19 -25
  113. package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
  114. package/lib/cjs/geometry3d/Ellipsoid.js +1 -1
  115. package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
  116. package/lib/cjs/geometry3d/GrowableXYArray.d.ts +1 -1
  117. package/lib/cjs/geometry3d/GrowableXYArray.js +1 -1
  118. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  119. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +8 -3
  120. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  121. package/lib/cjs/geometry3d/GrowableXYZArray.js +21 -3
  122. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  123. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +11 -1
  124. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  125. package/lib/cjs/geometry3d/IndexedXYZCollection.js +21 -3
  126. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  127. package/lib/cjs/geometry3d/Plane3d.d.ts +2 -0
  128. package/lib/cjs/geometry3d/Plane3d.d.ts.map +1 -1
  129. package/lib/cjs/geometry3d/Plane3d.js +6 -1
  130. package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
  131. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +2 -0
  132. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
  133. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js +6 -1
  134. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  135. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts +8 -2
  136. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
  137. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js +18 -10
  138. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  139. package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
  140. package/lib/cjs/geometry3d/Point2dVector2d.js +0 -2
  141. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  142. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +4 -4
  143. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  144. package/lib/cjs/geometry3d/Point3dVector3d.js +4 -5
  145. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  146. package/lib/cjs/geometry3d/PointHelpers.d.ts +7 -7
  147. package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
  148. package/lib/cjs/geometry3d/PointHelpers.js +66 -26
  149. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  150. package/lib/cjs/geometry3d/PolygonOps.d.ts +49 -2
  151. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  152. package/lib/cjs/geometry3d/PolygonOps.js +38 -2
  153. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  154. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts +13 -6
  155. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
  156. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js +16 -9
  157. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  158. package/lib/cjs/geometry3d/PolylineOps.d.ts +5 -4
  159. package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
  160. package/lib/cjs/geometry3d/PolylineOps.js +5 -4
  161. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  162. package/lib/cjs/geometry3d/Range.d.ts +18 -10
  163. package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
  164. package/lib/cjs/geometry3d/Range.js +32 -10
  165. package/lib/cjs/geometry3d/Range.js.map +1 -1
  166. package/lib/cjs/geometry3d/Ray2d.d.ts.map +1 -1
  167. package/lib/cjs/geometry3d/Ray2d.js +0 -1
  168. package/lib/cjs/geometry3d/Ray2d.js.map +1 -1
  169. package/lib/cjs/geometry3d/Ray3d.d.ts +7 -9
  170. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  171. package/lib/cjs/geometry3d/Ray3d.js +23 -45
  172. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  173. package/lib/cjs/geometry3d/ReusableObjectCache.d.ts +39 -29
  174. package/lib/cjs/geometry3d/ReusableObjectCache.d.ts.map +1 -1
  175. package/lib/cjs/geometry3d/ReusableObjectCache.js +49 -35
  176. package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
  177. package/lib/cjs/geometry3d/SortablePolygon.d.ts +1 -4
  178. package/lib/cjs/geometry3d/SortablePolygon.d.ts.map +1 -1
  179. package/lib/cjs/geometry3d/SortablePolygon.js +48 -43
  180. package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
  181. package/lib/cjs/geometry3d/Transform.d.ts +21 -2
  182. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  183. package/lib/cjs/geometry3d/Transform.js +32 -13
  184. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  185. package/lib/cjs/geometry4d/Point4d.d.ts +8 -5
  186. package/lib/cjs/geometry4d/Point4d.d.ts.map +1 -1
  187. package/lib/cjs/geometry4d/Point4d.js +27 -16
  188. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  189. package/lib/cjs/numerics/BezierPolynomials.d.ts +2 -0
  190. package/lib/cjs/numerics/BezierPolynomials.d.ts.map +1 -1
  191. package/lib/cjs/numerics/BezierPolynomials.js +11 -0
  192. package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
  193. package/lib/cjs/numerics/SmallSystem.d.ts +77 -36
  194. package/lib/cjs/numerics/SmallSystem.d.ts.map +1 -1
  195. package/lib/cjs/numerics/SmallSystem.js +129 -73
  196. package/lib/cjs/numerics/SmallSystem.js.map +1 -1
  197. package/lib/cjs/polyface/FacetOrientation.d.ts +1 -1
  198. package/lib/cjs/polyface/FacetOrientation.js +1 -1
  199. package/lib/cjs/polyface/FacetOrientation.js.map +1 -1
  200. package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts +55 -40
  201. package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
  202. package/lib/cjs/polyface/IndexedEdgeMatcher.js +83 -75
  203. package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
  204. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts +15 -14
  205. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  206. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +47 -38
  207. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  208. package/lib/cjs/polyface/IndexedPolyfaceWalker.d.ts +26 -19
  209. package/lib/cjs/polyface/IndexedPolyfaceWalker.d.ts.map +1 -1
  210. package/lib/cjs/polyface/IndexedPolyfaceWalker.js +51 -32
  211. package/lib/cjs/polyface/IndexedPolyfaceWalker.js.map +1 -1
  212. package/lib/cjs/polyface/Polyface.d.ts +19 -5
  213. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  214. package/lib/cjs/polyface/Polyface.js +18 -2
  215. package/lib/cjs/polyface/Polyface.js.map +1 -1
  216. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +1 -1
  217. package/lib/cjs/polyface/PolyfaceBuilder.js +6 -6
  218. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  219. package/lib/cjs/polyface/PolyfaceClip.d.ts +19 -18
  220. package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
  221. package/lib/cjs/polyface/PolyfaceClip.js +39 -42
  222. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  223. package/lib/cjs/polyface/PolyfaceData.d.ts +1 -1
  224. package/lib/cjs/polyface/PolyfaceData.js +1 -1
  225. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  226. package/lib/cjs/polyface/PolyfaceQuery.d.ts +119 -78
  227. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  228. package/lib/cjs/polyface/PolyfaceQuery.js +315 -231
  229. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  230. package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts +3 -3
  231. package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
  232. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js +3 -3
  233. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  234. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts +7 -6
  235. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
  236. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js +8 -9
  237. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  238. package/lib/cjs/serialization/BGFBReader.d.ts.map +1 -1
  239. package/lib/cjs/serialization/BGFBReader.js +2 -3
  240. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  241. package/lib/cjs/serialization/BGFBWriter.d.ts.map +1 -1
  242. package/lib/cjs/serialization/BGFBWriter.js +2 -4
  243. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  244. package/lib/cjs/serialization/GeometrySamples.d.ts +1 -1
  245. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  246. package/lib/cjs/serialization/GeometrySamples.js +3 -3
  247. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  248. package/lib/cjs/serialization/IModelJsonSchema.d.ts +3 -3
  249. package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
  250. package/lib/cjs/serialization/IModelJsonSchema.js +5 -5
  251. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  252. package/lib/cjs/solid/Box.d.ts.map +1 -1
  253. package/lib/cjs/solid/Box.js +7 -0
  254. package/lib/cjs/solid/Box.js.map +1 -1
  255. package/lib/cjs/solid/Cone.d.ts.map +1 -1
  256. package/lib/cjs/solid/Cone.js +6 -0
  257. package/lib/cjs/solid/Cone.js.map +1 -1
  258. package/lib/cjs/solid/LinearSweep.d.ts +2 -3
  259. package/lib/cjs/solid/LinearSweep.d.ts.map +1 -1
  260. package/lib/cjs/solid/LinearSweep.js +11 -7
  261. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  262. package/lib/cjs/solid/RotationalSweep.d.ts +2 -2
  263. package/lib/cjs/solid/RotationalSweep.js +2 -2
  264. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  265. package/lib/cjs/solid/RuledSweep.d.ts +1 -1
  266. package/lib/cjs/solid/RuledSweep.d.ts.map +1 -1
  267. package/lib/cjs/solid/RuledSweep.js +5 -1
  268. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  269. package/lib/cjs/solid/Sphere.d.ts.map +1 -1
  270. package/lib/cjs/solid/Sphere.js +6 -3
  271. package/lib/cjs/solid/Sphere.js.map +1 -1
  272. package/lib/cjs/solid/SweepContour.d.ts +1 -1
  273. package/lib/cjs/solid/SweepContour.js +1 -1
  274. package/lib/cjs/solid/SweepContour.js.map +1 -1
  275. package/lib/cjs/solid/TorusPipe.d.ts.map +1 -1
  276. package/lib/cjs/solid/TorusPipe.js +4 -0
  277. package/lib/cjs/solid/TorusPipe.js.map +1 -1
  278. package/lib/cjs/topology/ChainMerge.d.ts +1 -1
  279. package/lib/cjs/topology/ChainMerge.js +1 -1
  280. package/lib/cjs/topology/ChainMerge.js.map +1 -1
  281. package/lib/cjs/topology/Graph.d.ts +64 -14
  282. package/lib/cjs/topology/Graph.d.ts.map +1 -1
  283. package/lib/cjs/topology/Graph.js +149 -32
  284. package/lib/cjs/topology/Graph.js.map +1 -1
  285. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts +3 -2
  286. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  287. package/lib/cjs/topology/HalfEdgeGraphSearch.js +3 -2
  288. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  289. package/lib/cjs/topology/Merging.d.ts +0 -1
  290. package/lib/cjs/topology/Merging.d.ts.map +1 -1
  291. package/lib/cjs/topology/Merging.js +49 -46
  292. package/lib/cjs/topology/Merging.js.map +1 -1
  293. package/lib/cjs/topology/RegularizeFace.d.ts.map +1 -1
  294. package/lib/cjs/topology/RegularizeFace.js +2 -1
  295. package/lib/cjs/topology/RegularizeFace.js.map +1 -1
  296. package/lib/cjs/topology/Triangulation.d.ts +9 -14
  297. package/lib/cjs/topology/Triangulation.d.ts.map +1 -1
  298. package/lib/cjs/topology/Triangulation.js +29 -22
  299. package/lib/cjs/topology/Triangulation.js.map +1 -1
  300. package/lib/esm/Geometry.d.ts +18 -10
  301. package/lib/esm/Geometry.d.ts.map +1 -1
  302. package/lib/esm/Geometry.js +13 -3
  303. package/lib/esm/Geometry.js.map +1 -1
  304. package/lib/esm/bspline/BSpline1dNd.d.ts +1 -1
  305. package/lib/esm/bspline/BSpline1dNd.js +1 -1
  306. package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
  307. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  308. package/lib/esm/bspline/BSplineCurve.js +7 -1
  309. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  310. package/lib/esm/bspline/BSplineSurface.d.ts +4 -3
  311. package/lib/esm/bspline/BSplineSurface.d.ts.map +1 -1
  312. package/lib/esm/bspline/BSplineSurface.js +4 -5
  313. package/lib/esm/bspline/BSplineSurface.js.map +1 -1
  314. package/lib/esm/clipping/ClipPlane.d.ts +7 -5
  315. package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
  316. package/lib/esm/clipping/ClipPlane.js +9 -5
  317. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  318. package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
  319. package/lib/esm/clipping/ClipUtils.js +5 -3
  320. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  321. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +1 -2
  322. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  323. package/lib/esm/clipping/ConvexClipPlaneSet.js +13 -25
  324. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  325. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts +1 -2
  326. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  327. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js +1 -2
  328. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  329. package/lib/esm/core-geometry.d.ts +2 -0
  330. package/lib/esm/core-geometry.d.ts.map +1 -1
  331. package/lib/esm/core-geometry.js +2 -0
  332. package/lib/esm/core-geometry.js.map +1 -1
  333. package/lib/esm/curve/Arc3d.d.ts +54 -32
  334. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  335. package/lib/esm/curve/Arc3d.js +56 -37
  336. package/lib/esm/curve/Arc3d.js.map +1 -1
  337. package/lib/esm/curve/CurveCollection.d.ts +40 -1
  338. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  339. package/lib/esm/curve/CurveCollection.js +90 -0
  340. package/lib/esm/curve/CurveCollection.js.map +1 -1
  341. package/lib/esm/curve/CurveFactory.d.ts +3 -2
  342. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  343. package/lib/esm/curve/CurveFactory.js +6 -5
  344. package/lib/esm/curve/CurveFactory.js.map +1 -1
  345. package/lib/esm/curve/CurveLocationDetail.d.ts +27 -25
  346. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  347. package/lib/esm/curve/CurveLocationDetail.js +30 -25
  348. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  349. package/lib/esm/curve/CurvePrimitive.d.ts +9 -2
  350. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  351. package/lib/esm/curve/CurvePrimitive.js +11 -0
  352. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  353. package/lib/esm/curve/CurveTypes.d.ts +1 -1
  354. package/lib/esm/curve/CurveTypes.js.map +1 -1
  355. package/lib/esm/curve/LineSegment3d.d.ts +2 -0
  356. package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
  357. package/lib/esm/curve/LineSegment3d.js +4 -0
  358. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  359. package/lib/esm/curve/LineString3d.d.ts +7 -0
  360. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  361. package/lib/esm/curve/LineString3d.js +15 -3
  362. package/lib/esm/curve/LineString3d.js.map +1 -1
  363. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
  364. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js +37 -8
  365. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  366. package/lib/esm/curve/Query/PlanarSubdivision.d.ts +34 -8
  367. package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  368. package/lib/esm/curve/Query/PlanarSubdivision.js +131 -35
  369. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  370. package/lib/esm/curve/Query/StrokeCountChain.d.ts +4 -3
  371. package/lib/esm/curve/Query/StrokeCountChain.d.ts.map +1 -1
  372. package/lib/esm/curve/Query/StrokeCountChain.js +20 -9
  373. package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
  374. package/lib/esm/curve/RegionMomentsXY.d.ts +2 -1
  375. package/lib/esm/curve/RegionMomentsXY.d.ts.map +1 -1
  376. package/lib/esm/curve/RegionMomentsXY.js +26 -41
  377. package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
  378. package/lib/esm/curve/RegionOps.d.ts +74 -39
  379. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  380. package/lib/esm/curve/RegionOps.js +146 -46
  381. package/lib/esm/curve/RegionOps.js.map +1 -1
  382. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts +36 -27
  383. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  384. package/lib/esm/curve/RegionOpsClassificationSweeps.js +161 -56
  385. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  386. package/lib/esm/curve/StrokeOptions.d.ts +1 -1
  387. package/lib/esm/curve/StrokeOptions.js +1 -1
  388. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  389. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  390. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +2 -2
  391. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +6 -6
  392. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  393. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +0 -1
  394. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  395. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +58 -32
  396. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  397. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  398. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +0 -1
  399. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  400. package/lib/esm/curve/internalContexts/TransferWithSplitArcs.d.ts +14 -0
  401. package/lib/esm/curve/internalContexts/TransferWithSplitArcs.d.ts.map +1 -0
  402. package/lib/esm/curve/internalContexts/TransferWithSplitArcs.js +30 -0
  403. package/lib/esm/curve/internalContexts/TransferWithSplitArcs.js.map +1 -0
  404. package/lib/esm/geometry3d/AngleSweep.d.ts +25 -18
  405. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  406. package/lib/esm/geometry3d/AngleSweep.js +32 -18
  407. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  408. package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts +8 -7
  409. package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
  410. package/lib/esm/geometry3d/CoincidentGeometryOps.js +19 -25
  411. package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
  412. package/lib/esm/geometry3d/Ellipsoid.js +1 -1
  413. package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
  414. package/lib/esm/geometry3d/GrowableXYArray.d.ts +1 -1
  415. package/lib/esm/geometry3d/GrowableXYArray.js +1 -1
  416. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  417. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +8 -3
  418. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  419. package/lib/esm/geometry3d/GrowableXYZArray.js +21 -3
  420. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  421. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +11 -1
  422. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  423. package/lib/esm/geometry3d/IndexedXYZCollection.js +21 -3
  424. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  425. package/lib/esm/geometry3d/Plane3d.d.ts +2 -0
  426. package/lib/esm/geometry3d/Plane3d.d.ts.map +1 -1
  427. package/lib/esm/geometry3d/Plane3d.js +6 -1
  428. package/lib/esm/geometry3d/Plane3d.js.map +1 -1
  429. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +2 -0
  430. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
  431. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js +6 -1
  432. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  433. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts +8 -2
  434. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
  435. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js +18 -10
  436. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  437. package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
  438. package/lib/esm/geometry3d/Point2dVector2d.js +0 -2
  439. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  440. package/lib/esm/geometry3d/Point3dVector3d.d.ts +4 -4
  441. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  442. package/lib/esm/geometry3d/Point3dVector3d.js +4 -5
  443. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  444. package/lib/esm/geometry3d/PointHelpers.d.ts +7 -7
  445. package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
  446. package/lib/esm/geometry3d/PointHelpers.js +66 -26
  447. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  448. package/lib/esm/geometry3d/PolygonOps.d.ts +49 -2
  449. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  450. package/lib/esm/geometry3d/PolygonOps.js +38 -2
  451. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  452. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts +13 -6
  453. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
  454. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js +16 -9
  455. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  456. package/lib/esm/geometry3d/PolylineOps.d.ts +5 -4
  457. package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
  458. package/lib/esm/geometry3d/PolylineOps.js +5 -4
  459. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  460. package/lib/esm/geometry3d/Range.d.ts +18 -10
  461. package/lib/esm/geometry3d/Range.d.ts.map +1 -1
  462. package/lib/esm/geometry3d/Range.js +32 -10
  463. package/lib/esm/geometry3d/Range.js.map +1 -1
  464. package/lib/esm/geometry3d/Ray2d.d.ts.map +1 -1
  465. package/lib/esm/geometry3d/Ray2d.js +0 -1
  466. package/lib/esm/geometry3d/Ray2d.js.map +1 -1
  467. package/lib/esm/geometry3d/Ray3d.d.ts +7 -9
  468. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  469. package/lib/esm/geometry3d/Ray3d.js +23 -45
  470. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  471. package/lib/esm/geometry3d/ReusableObjectCache.d.ts +39 -29
  472. package/lib/esm/geometry3d/ReusableObjectCache.d.ts.map +1 -1
  473. package/lib/esm/geometry3d/ReusableObjectCache.js +47 -33
  474. package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
  475. package/lib/esm/geometry3d/SortablePolygon.d.ts +1 -4
  476. package/lib/esm/geometry3d/SortablePolygon.d.ts.map +1 -1
  477. package/lib/esm/geometry3d/SortablePolygon.js +48 -43
  478. package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
  479. package/lib/esm/geometry3d/Transform.d.ts +21 -2
  480. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  481. package/lib/esm/geometry3d/Transform.js +32 -13
  482. package/lib/esm/geometry3d/Transform.js.map +1 -1
  483. package/lib/esm/geometry4d/Point4d.d.ts +8 -5
  484. package/lib/esm/geometry4d/Point4d.d.ts.map +1 -1
  485. package/lib/esm/geometry4d/Point4d.js +27 -16
  486. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  487. package/lib/esm/numerics/BezierPolynomials.d.ts +2 -0
  488. package/lib/esm/numerics/BezierPolynomials.d.ts.map +1 -1
  489. package/lib/esm/numerics/BezierPolynomials.js +11 -0
  490. package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
  491. package/lib/esm/numerics/SmallSystem.d.ts +77 -36
  492. package/lib/esm/numerics/SmallSystem.d.ts.map +1 -1
  493. package/lib/esm/numerics/SmallSystem.js +129 -73
  494. package/lib/esm/numerics/SmallSystem.js.map +1 -1
  495. package/lib/esm/polyface/FacetOrientation.d.ts +1 -1
  496. package/lib/esm/polyface/FacetOrientation.js +1 -1
  497. package/lib/esm/polyface/FacetOrientation.js.map +1 -1
  498. package/lib/esm/polyface/IndexedEdgeMatcher.d.ts +55 -40
  499. package/lib/esm/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
  500. package/lib/esm/polyface/IndexedEdgeMatcher.js +83 -75
  501. package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
  502. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts +15 -14
  503. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  504. package/lib/esm/polyface/IndexedPolyfaceVisitor.js +47 -38
  505. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  506. package/lib/esm/polyface/IndexedPolyfaceWalker.d.ts +26 -19
  507. package/lib/esm/polyface/IndexedPolyfaceWalker.d.ts.map +1 -1
  508. package/lib/esm/polyface/IndexedPolyfaceWalker.js +51 -32
  509. package/lib/esm/polyface/IndexedPolyfaceWalker.js.map +1 -1
  510. package/lib/esm/polyface/Polyface.d.ts +19 -5
  511. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  512. package/lib/esm/polyface/Polyface.js +18 -2
  513. package/lib/esm/polyface/Polyface.js.map +1 -1
  514. package/lib/esm/polyface/PolyfaceBuilder.d.ts +1 -1
  515. package/lib/esm/polyface/PolyfaceBuilder.js +6 -6
  516. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  517. package/lib/esm/polyface/PolyfaceClip.d.ts +19 -18
  518. package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
  519. package/lib/esm/polyface/PolyfaceClip.js +39 -42
  520. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  521. package/lib/esm/polyface/PolyfaceData.d.ts +1 -1
  522. package/lib/esm/polyface/PolyfaceData.js +1 -1
  523. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  524. package/lib/esm/polyface/PolyfaceQuery.d.ts +119 -78
  525. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  526. package/lib/esm/polyface/PolyfaceQuery.js +316 -232
  527. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  528. package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts +3 -3
  529. package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
  530. package/lib/esm/polyface/RangeTree/RangeTreeNode.js +3 -3
  531. package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  532. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts +7 -6
  533. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
  534. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js +8 -9
  535. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  536. package/lib/esm/serialization/BGFBReader.d.ts.map +1 -1
  537. package/lib/esm/serialization/BGFBReader.js +2 -3
  538. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  539. package/lib/esm/serialization/BGFBWriter.d.ts.map +1 -1
  540. package/lib/esm/serialization/BGFBWriter.js +2 -4
  541. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  542. package/lib/esm/serialization/GeometrySamples.d.ts +1 -1
  543. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  544. package/lib/esm/serialization/GeometrySamples.js +3 -3
  545. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  546. package/lib/esm/serialization/IModelJsonSchema.d.ts +3 -3
  547. package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
  548. package/lib/esm/serialization/IModelJsonSchema.js +5 -5
  549. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  550. package/lib/esm/solid/Box.d.ts.map +1 -1
  551. package/lib/esm/solid/Box.js +7 -0
  552. package/lib/esm/solid/Box.js.map +1 -1
  553. package/lib/esm/solid/Cone.d.ts.map +1 -1
  554. package/lib/esm/solid/Cone.js +6 -0
  555. package/lib/esm/solid/Cone.js.map +1 -1
  556. package/lib/esm/solid/LinearSweep.d.ts +2 -3
  557. package/lib/esm/solid/LinearSweep.d.ts.map +1 -1
  558. package/lib/esm/solid/LinearSweep.js +11 -7
  559. package/lib/esm/solid/LinearSweep.js.map +1 -1
  560. package/lib/esm/solid/RotationalSweep.d.ts +2 -2
  561. package/lib/esm/solid/RotationalSweep.js +2 -2
  562. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  563. package/lib/esm/solid/RuledSweep.d.ts +1 -1
  564. package/lib/esm/solid/RuledSweep.d.ts.map +1 -1
  565. package/lib/esm/solid/RuledSweep.js +5 -1
  566. package/lib/esm/solid/RuledSweep.js.map +1 -1
  567. package/lib/esm/solid/Sphere.d.ts.map +1 -1
  568. package/lib/esm/solid/Sphere.js +6 -3
  569. package/lib/esm/solid/Sphere.js.map +1 -1
  570. package/lib/esm/solid/SweepContour.d.ts +1 -1
  571. package/lib/esm/solid/SweepContour.js +1 -1
  572. package/lib/esm/solid/SweepContour.js.map +1 -1
  573. package/lib/esm/solid/TorusPipe.d.ts.map +1 -1
  574. package/lib/esm/solid/TorusPipe.js +4 -0
  575. package/lib/esm/solid/TorusPipe.js.map +1 -1
  576. package/lib/esm/topology/ChainMerge.d.ts +1 -1
  577. package/lib/esm/topology/ChainMerge.js +1 -1
  578. package/lib/esm/topology/ChainMerge.js.map +1 -1
  579. package/lib/esm/topology/Graph.d.ts +64 -14
  580. package/lib/esm/topology/Graph.d.ts.map +1 -1
  581. package/lib/esm/topology/Graph.js +149 -32
  582. package/lib/esm/topology/Graph.js.map +1 -1
  583. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts +3 -2
  584. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  585. package/lib/esm/topology/HalfEdgeGraphSearch.js +3 -2
  586. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  587. package/lib/esm/topology/Merging.d.ts +0 -1
  588. package/lib/esm/topology/Merging.d.ts.map +1 -1
  589. package/lib/esm/topology/Merging.js +49 -46
  590. package/lib/esm/topology/Merging.js.map +1 -1
  591. package/lib/esm/topology/RegularizeFace.d.ts.map +1 -1
  592. package/lib/esm/topology/RegularizeFace.js +2 -1
  593. package/lib/esm/topology/RegularizeFace.js.map +1 -1
  594. package/lib/esm/topology/Triangulation.d.ts +9 -14
  595. package/lib/esm/topology/Triangulation.d.ts.map +1 -1
  596. package/lib/esm/topology/Triangulation.js +29 -22
  597. package/lib/esm/topology/Triangulation.js.map +1 -1
  598. package/package.json +7 -6
@@ -1 +1 @@
1
- {"version":3,"file":"Ray2d.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/Ray2d.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAIlE;;;GAGG;AACH,qBAAa,KAAK;IAChB,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,UAAU,CAAW;IAE7B,OAAO;IAIP,kDAAkD;IAC3C,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,GAAG,IAAI;IAItD;;;;;OAKG;WACW,qBAAqB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK;IAQ5F;;;;;OAKG;WACW,wBAAwB,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK;IAOnG,qDAAqD;WACvC,+BAA+B,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK;IAQ1G,2CAA2C;IAC3C,IAAW,MAAM,YAA2B;IAC5C,8CAA8C;IAC9C,IAAW,SAAS,aAA8B;IAClD;;;OAGG;IACI,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK;IAQ/D,6FAA6F;IACtF,mBAAmB,CAAC,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK;IAQjD,sFAAsF;IAC/E,k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EAAE,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK;IAQ1G,2CAA2C;IAC3C,IAAW,MAAM,YAA2B;IAC5C,8CAA8C;IAC9C,IAAW,SAAS,aAA8B;IAClD;;;OAGG;IACI,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK;IAQ/D,6FAA6F;IACtF,mBAAmB,CAAC,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK;IAQjD,sFAAsF;IAC/E,kBAAkB,CAAC,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK;IAQhD;;;;;OAKG;IACI,yBAAyB,CAAC,QAAQ,GAAE,MAAU,EAAE,QAAQ,GAAE,MAAU,GAAG,OAAO;IAOrF;;;;;;;;OAQG;IACI,sBAAsB,CAAC,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,GAAG;QAAE,eAAe,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;IAUtI,2EAA2E;IACpE,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM;IAGjD,yFAAyF;IAClF,+BAA+B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM;IAM9D,uDAAuD;IAChD,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;CAG7D"}
@@ -6,7 +6,6 @@
6
6
  * @module CartesianGeometry
7
7
  */
8
8
  import { Geometry } from "../Geometry";
9
- // cspell:word CCWXY, CWXY
10
9
  /**
11
10
  * Ray with xy origin and direction
12
11
  * @public
@@ -1 +1 @@
1
- {"version":3,"file":"Ray2d.js","sourceRoot":"","sources":["../../../src/geometry3d/Ray2d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,0BAA0B;AAE1B;;;GAGG;AACH,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E,eAAe,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAChF,CAAC;IACD,2EAA2E;IACpE,kBAAkB,CAAC,KAAc;QACtC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,4BAA4B,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACpF,CAAC;IACD,yFAAyF;IAClF,+BAA+B,CAAC,KAAc;QACnD,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QACtE,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC;QAC9C,oDAAoD;QACpD,OAAO,QAAQ,CAAC,kBAAkB,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;IAClD,CAAC;IACD,uDAAuD;IAChD,eAAe,CAAC,CAAS,EAAE,MAAgB;QAChD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;IAC7D,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 */\n\nimport { Geometry } from \"../Geometry\";\nimport { Point2d, Vector2d } from \"../geometry3d/Point2dVector2d\";\n\n// cspell:word CCWXY, CWXY\n\n/**\n * Ray with xy origin and direction\n * @public\n */\nexport class Ray2d {\n private _origin: Point2d;\n private _direction: Vector2d;\n\n private constructor(origin: Point2d, direction: Vector2d) {\n this._origin = origin;\n this._direction = direction;\n }\n /** Copy coordinates from origin and direction. */\n public set(origin: Point2d, direction: Vector2d): void {\n this._origin.setFrom(origin);\n this._direction.setFrom(direction);\n }\n /**\n * Create from `origin` and `target` points.\n * @param origin ray origin, cloned\n * @param target end of ray direction vector. The direction vector is `target - origin`.\n * @param result optional pre-allocated object to return\n */\n public static createOriginAndTarget(origin: Point2d, target: Point2d, result?: Ray2d): Ray2d {\n if (result) {\n result._origin.setFrom(origin);\n result._direction.set(target.x - origin.x, target.y - origin.y);\n return result;\n }\n return new Ray2d(origin.clone(), origin.vectorTo(target));\n }\n /**\n * Create by copying coordinates from `origin` and `direction`.\n * @param origin ray origin\n * @param direction ray direction\n * @param result optional pre-allocated object to return\n */\n public static createOriginAndDirection(origin: Point2d, direction: Vector2d, result?: Ray2d): Ray2d {\n if (result) {\n result.set(origin, direction);\n return result;\n }\n return new Ray2d(origin.clone(), direction.clone());\n }\n /** Create from captured `origin` and `direction`. */\n public static createOriginAndDirectionCapture(origin: Point2d, direction: Vector2d, result?: Ray2d): Ray2d {\n if (result) {\n result._origin = origin;\n result._direction = direction;\n return result;\n }\n return new Ray2d(origin, direction);\n }\n /** Get the reference to the ray origin. */\n public get origin() { return this._origin; }\n /** Get the reference to the ray direction. */\n public get direction() { return this._direction; }\n /**\n * Return a parallel ray to the left of this ray.\n * @param leftFraction distance between rays, as a fraction of the magnitude of this ray's direction vector\n */\n public parallelRay(leftFraction: number, result?: Ray2d): Ray2d {\n if (result) {\n this._origin.addForwardLeft(0.0, leftFraction, this._direction, result._origin);\n result._direction.setFrom(this._direction);\n return result;\n }\n return new Ray2d(this._origin.addForwardLeft(0.0, leftFraction, this._direction), this._direction.clone());\n }\n /** Return a ray with cloned origin and with direction rotated 90 degrees counterclockwise */\n public ccwPerpendicularRay(result?: Ray2d): Ray2d {\n if (result) {\n result._origin.setFrom(this._origin);\n this._direction.rotate90CCWXY(result._direction);\n return result;\n }\n return new Ray2d(this._origin.clone(), this._direction.rotate90CCWXY());\n }\n /** Return a ray with cloned origin and with direction rotated 90 degrees clockwise */\n public cwPerpendicularRay(result?: Ray2d): Ray2d {\n if (result) {\n result._origin.setFrom(this._origin);\n this._direction.rotate90CWXY(result._direction);\n return result;\n }\n return new Ray2d(this._origin.clone(), this._direction.rotate90CWXY());\n }\n /**\n * Normalize the direction vector in place.\n * @param defaultX value to set `this.direction.x` if normalization fails. Default value 1.\n * @param defaultY value to set `this.direction.y` if normalization fails. Default value 0.\n * @returns whether normalization succeeded (i.e., direction is nonzero)\n */\n public normalizeDirectionInPlace(defaultX: number = 1, defaultY: number = 0): boolean {\n if (this._direction.normalize(this._direction))\n return true;\n this._direction.x = defaultX;\n this._direction.y = defaultY;\n return false;\n }\n /**\n * Intersect this ray with the unbounded line defined by the given points.\n * @param linePointA start of the line\n * @param linePointB end of the line\n * @returns object with named values:\n * * `hasIntersection`: whether the intersection exists.\n * * `fraction`: ray parameter of intersection, or 0.0 if `!hasIntersection`. If the instance is normalized, this is the signed distance along the ray to the intersection point.\n * * `cross`: the 2D cross product `this.direction x (linePointB - linePointA)`, useful for determining orientation of the line and ray.\n */\n public intersectUnboundedLine(linePointA: Point2d, linePointB: Point2d): { hasIntersection: boolean, fraction: number, cross: number } {\n const lineDirection = linePointA.vectorTo(linePointB);\n const vector0 = linePointA.vectorTo(this._origin);\n const h0 = vector0.crossProduct(lineDirection);\n const dHds = this._direction.crossProduct(lineDirection);\n // h = h0 + s * dh\n const ff = Geometry.conditionalDivideFraction(-h0, dHds);\n const hasIntersection = ff !== undefined;\n return { hasIntersection, fraction: hasIntersection ? ff : 0.0, cross: dHds };\n }\n /** Return the ray fraction where the given point projects onto the ray. */\n public projectionFraction(point: Point2d): number {\n return this._origin.vectorTo(point).fractionOfProjectionToVector(this._direction);\n }\n /** Return the ray fraction where the given point projects onto the perpendicular ray. */\n public perpendicularProjectionFraction(point: Point2d): number {\n const uv = this._direction.crossProduct(this._origin.vectorTo(point));\n const uu = this._direction.magnitudeSquared();\n // Want zero returned if failure case, not undefined\n return Geometry.safeDivideFraction(uv, uu, 0.0);\n }\n /** Compute and return origin plus scaled direction. */\n public fractionToPoint(f: number, result?: Point2d): Point2d {\n return this._origin.plusScaled(this._direction, f, result);\n }\n}\n"]}
1
+ {"version":3,"file":"Ray2d.js","sourceRoot":"","sources":["../../../src/geometry3d/Ray2d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC;;;GAGG;AACH,MAAM,OAAO,KAAK;IACR,OAAO,CAAU;IACjB,UAAU,CAAW;IAE7B,YAAoB,MAAe,EAAE,SAAmB;QACtD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;IACD,kDAAkD;IAC3C,GAAG,CAAC,MAAe,EAAE,SAAmB;QAC7C,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC7B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACrC,CAAC;IACD;;;;;OAKG;IACI,MAAM,CAAC,qBAAqB,CAAC,MAAe,EAAE,MAAe,EAAE,MAAc;QAClF,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAC/B,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YAChE,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5D,CAAC;IACD;;;;;OAKG;IACI,MAAM,CAAC,wBAAwB,CAAC,MAAe,EAAE,SAAmB,EAAE,MAAc;QACzF,IAAI,MAAM,EAAE,CAAC;YACX,M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C,YAAY,CAAC,aAAa,CAAC,CAAC;QAC/C,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;QACzD,kBAAkB;QAClB,MAAM,EAAE,GAAG,QAAQ,CAAC,yBAAyB,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;QACzD,MAAM,eAAe,GAAG,EAAE,KAAK,SAAS,CAAC;QACzC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAChF,CAAC;IACD,2EAA2E;IACpE,kBAAkB,CAAC,KAAc;QACtC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,4BAA4B,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACpF,CAAC;IACD,yFAAyF;IAClF,+BAA+B,CAAC,KAAc;QACnD,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QACtE,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC;QAC9C,oDAAoD;QACpD,OAAO,QAAQ,CAAC,kBAAkB,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;IAClD,CAAC;IACD,uDAAuD;IAChD,eAAe,CAAC,CAAS,EAAE,MAAgB;QAChD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;IAC7D,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 */\n\nimport { Geometry } from \"../Geometry\";\nimport { Point2d, Vector2d } from \"../geometry3d/Point2dVector2d\";\n\n/**\n * Ray with xy origin and direction\n * @public\n */\nexport class Ray2d {\n private _origin: Point2d;\n private _direction: Vector2d;\n\n private constructor(origin: Point2d, direction: Vector2d) {\n this._origin = origin;\n this._direction = direction;\n }\n /** Copy coordinates from origin and direction. */\n public set(origin: Point2d, direction: Vector2d): void {\n this._origin.setFrom(origin);\n this._direction.setFrom(direction);\n }\n /**\n * Create from `origin` and `target` points.\n * @param origin ray origin, cloned\n * @param target end of ray direction vector. The direction vector is `target - origin`.\n * @param result optional pre-allocated object to return\n */\n public static createOriginAndTarget(origin: Point2d, target: Point2d, result?: Ray2d): Ray2d {\n if (result) {\n result._origin.setFrom(origin);\n result._direction.set(target.x - origin.x, target.y - origin.y);\n return result;\n }\n return new Ray2d(origin.clone(), origin.vectorTo(target));\n }\n /**\n * Create by copying coordinates from `origin` and `direction`.\n * @param origin ray origin\n * @param direction ray direction\n * @param result optional pre-allocated object to return\n */\n public static createOriginAndDirection(origin: Point2d, direction: Vector2d, result?: Ray2d): Ray2d {\n if (result) {\n result.set(origin, direction);\n return result;\n }\n return new Ray2d(origin.clone(), direction.clone());\n }\n /** Create from captured `origin` and `direction`. */\n public static createOriginAndDirectionCapture(origin: Point2d, direction: Vector2d, result?: Ray2d): Ray2d {\n if (result) {\n result._origin = origin;\n result._direction = direction;\n return result;\n }\n return new Ray2d(origin, direction);\n }\n /** Get the reference to the ray origin. */\n public get origin() { return this._origin; }\n /** Get the reference to the ray direction. */\n public get direction() { return this._direction; }\n /**\n * Return a parallel ray to the left of this ray.\n * @param leftFraction distance between rays, as a fraction of the magnitude of this ray's direction vector\n */\n public parallelRay(leftFraction: number, result?: Ray2d): Ray2d {\n if (result) {\n this._origin.addForwardLeft(0.0, leftFraction, this._direction, result._origin);\n result._direction.setFrom(this._direction);\n return result;\n }\n return new Ray2d(this._origin.addForwardLeft(0.0, leftFraction, this._direction), this._direction.clone());\n }\n /** Return a ray with cloned origin and with direction rotated 90 degrees counterclockwise */\n public ccwPerpendicularRay(result?: Ray2d): Ray2d {\n if (result) {\n result._origin.setFrom(this._origin);\n this._direction.rotate90CCWXY(result._direction);\n return result;\n }\n return new Ray2d(this._origin.clone(), this._direction.rotate90CCWXY());\n }\n /** Return a ray with cloned origin and with direction rotated 90 degrees clockwise */\n public cwPerpendicularRay(result?: Ray2d): Ray2d {\n if (result) {\n result._origin.setFrom(this._origin);\n this._direction.rotate90CWXY(result._direction);\n return result;\n }\n return new Ray2d(this._origin.clone(), this._direction.rotate90CWXY());\n }\n /**\n * Normalize the direction vector in place.\n * @param defaultX value to set `this.direction.x` if normalization fails. Default value 1.\n * @param defaultY value to set `this.direction.y` if normalization fails. Default value 0.\n * @returns whether normalization succeeded (i.e., direction is nonzero)\n */\n public normalizeDirectionInPlace(defaultX: number = 1, defaultY: number = 0): boolean {\n if (this._direction.normalize(this._direction))\n return true;\n this._direction.x = defaultX;\n this._direction.y = defaultY;\n return false;\n }\n /**\n * Intersect this ray with the unbounded line defined by the given points.\n * @param linePointA start of the line\n * @param linePointB end of the line\n * @returns object with named values:\n * * `hasIntersection`: whether the intersection exists.\n * * `fraction`: ray parameter of intersection, or 0.0 if `!hasIntersection`. If the instance is normalized, this is the signed distance along the ray to the intersection point.\n * * `cross`: the 2D cross product `this.direction x (linePointB - linePointA)`, useful for determining orientation of the line and ray.\n */\n public intersectUnboundedLine(linePointA: Point2d, linePointB: Point2d): { hasIntersection: boolean, fraction: number, cross: number } {\n const lineDirection = linePointA.vectorTo(linePointB);\n const vector0 = linePointA.vectorTo(this._origin);\n const h0 = vector0.crossProduct(lineDirection);\n const dHds = this._direction.crossProduct(lineDirection);\n // h = h0 + s * dh\n const ff = Geometry.conditionalDivideFraction(-h0, dHds);\n const hasIntersection = ff !== undefined;\n return { hasIntersection, fraction: hasIntersection ? ff : 0.0, cross: dHds };\n }\n /** Return the ray fraction where the given point projects onto the ray. */\n public projectionFraction(point: Point2d): number {\n return this._origin.vectorTo(point).fractionOfProjectionToVector(this._direction);\n }\n /** Return the ray fraction where the given point projects onto the perpendicular ray. */\n public perpendicularProjectionFraction(point: Point2d): number {\n const uv = this._direction.crossProduct(this._origin.vectorTo(point));\n const uu = this._direction.magnitudeSquared();\n // Want zero returned if failure case, not undefined\n return Geometry.safeDivideFraction(uv, uu, 0.0);\n }\n /** Compute and return origin plus scaled direction. */\n public fractionToPoint(f: number, result?: Point2d): Point2d {\n return this._origin.plusScaled(this._direction, f, result);\n }\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * @module CartesianGeometry
3
3
  */
4
4
  import { CurveLocationDetailPair } from "../curve/CurveLocationDetail";
5
- import { BeJSONFunctions } from "../Geometry";
5
+ import { BeJSONFunctions, PerpParallelOptions } from "../Geometry";
6
6
  import { Plane3dByOriginAndUnitNormal } from "./Plane3dByOriginAndUnitNormal";
7
7
  import { Point3d, Vector3d } from "./Point3dVector3d";
8
8
  import { Range1d, Range3d } from "./Range";
@@ -39,12 +39,10 @@ export declare class Ray3d implements BeJSONFunctions {
39
39
  /** Create a ray with all zeros. */
40
40
  static createZero(result?: Ray3d): Ray3d;
41
41
  /**
42
- * Test for nearly equal Ray3d objects.
43
- * * This tests for near equality of origin and direction -- i.e. member-by-member comparison.
44
- * * Use [[isAlmostEqualPointSet]] to allow origins to be anywhere along the common ray and to have to allow the
45
- * directions to be scaled or opposing.
42
+ * Test for nearly equal Ray3d objects by comparing their origin and direction members.
43
+ * @see [[isAlmostEqualPointSet]] to test for rays on the same infinite line.
46
44
  */
47
- isAlmostEqual(other: Ray3d): boolean;
45
+ isAlmostEqual(other: Ray3d, tolerance?: number): boolean;
48
46
  /**
49
47
  * Return the dot product of the ray's direction vector with a vector from the ray origin
50
48
  * to the `spacePoint`.
@@ -58,10 +56,10 @@ export declare class Ray3d implements BeJSONFunctions {
58
56
  /** Return the `spacePoint` projected onto the ray. */
59
57
  projectPointToRay(spacePoint: Point3d): Point3d;
60
58
  /**
61
- * Test for nearly equal rays, allowing origin float and direction scaling.
62
- * * Use [[isAlmostEqual]] to require member-by-member comparison.
59
+ * Test for rays that describe the same infinite line.
60
+ * @see [[isAlmostEqual]] for member-by-member comparison.
63
61
  */
64
- isAlmostEqualPointSet(other: Ray3d): boolean;
62
+ isAlmostEqualPointSet(other: Ray3d, options?: PerpParallelOptions): boolean;
65
63
  /** Create a ray from origin and direction. */
66
64
  static create(origin: Point3d, direction: Vector3d, result?: Ray3d): Ray3d;
67
65
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Ray3d.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/Ray3d.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,EAA+C,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACpH,OAAO,EAAa,eAAe,EAAY,MAAM,aAAa,CAAC;AAGnE,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAE9E,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGpC;;;;;;GAMG;AACH,qBAAa,KAAM,YAAW,eAAe;IAC3C,qBAAqB;IACd,MAAM,EAAE,OAAO,CAAC;IACvB,0EAA0E;IACnE,SAAS,EAAE,QAAQ,CAAC;IAC3B,0BAA0B;IACnB,CAAC,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAW;IACvC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAW;IACvC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAW;IACvC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAW;IACvC,OAAO,CAAC,MAAM,CAAC,YAA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,EAAE,QAAQ,GAAG,QAAQ;IAO1F;;;;;;;;;;;;OAYG;WACW,yBAAyB,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,uBAAuB;IAgC1F;;;;;;;;OAQG;WACW,0BAA0B,CACtC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,GAC/E,KAAK;CAcT"}
@@ -65,13 +65,11 @@ export class Ray3d {
65
65
  return new Ray3d(Point3d.createZero(), Vector3d.createZero());
66
66
  }
67
67
  /**
68
- * Test for nearly equal Ray3d objects.
69
- * * This tests for near equality of origin and direction -- i.e. member-by-member comparison.
70
- * * Use [[isAlmostEqualPointSet]] to allow origins to be anywhere along the common ray and to have to allow the
71
- * directions to be scaled or opposing.
68
+ * Test for nearly equal Ray3d objects by comparing their origin and direction members.
69
+ * @see [[isAlmostEqualPointSet]] to test for rays on the same infinite line.
72
70
  */
73
- isAlmostEqual(other) {
74
- return this.origin.isAlmostEqual(other.origin) && this.direction.isAlmostEqual(other.direction);
71
+ isAlmostEqual(other, tolerance = Geometry.smallMetricDistance) {
72
+ return this.origin.isAlmostEqual(other.origin, tolerance) && this.direction.isAlmostEqual(other.direction, tolerance);
75
73
  }
76
74
  /**
77
75
  * Return the dot product of the ray's direction vector with a vector from the ray origin
@@ -99,27 +97,19 @@ export class Ray3d {
99
97
  return this.origin.plusScaled(this.direction, this.pointToFraction(spacePoint));
100
98
  }
101
99
  /**
102
- * Test for nearly equal rays, allowing origin float and direction scaling.
103
- * * Use [[isAlmostEqual]] to require member-by-member comparison.
100
+ * Test for rays that describe the same infinite line.
101
+ * @see [[isAlmostEqual]] for member-by-member comparison.
104
102
  */
105
- isAlmostEqualPointSet(other) {
106
- /**
107
- * This function tests two rays to determine if they define the same infinite lines.
108
- * So the origins can be different as long as they are on the infinite line (they can
109
- * "float") but the directions must be parallel or antiparallel.
110
- */
111
- if (!this.direction.isParallelTo(other.direction, true))
103
+ isAlmostEqualPointSet(other, options) {
104
+ if (!this.direction.isParallelTo(other.direction, true, false, options))
112
105
  return false;
113
- /**
114
- * In exact math, we consider a ray to have an infinite line as direction (not a finite vector).
115
- * Therefore, in exact math it is not possible for one origin to be on the other ray but not vice
116
- * versa. However, we test both ways because first check may pass due to round-off errors.
117
- */
106
+ const tol2 = options?.distanceSquaredTol ?? Geometry.smallMetricDistanceSquared;
107
+ // theoretically, one test below is sufficient, but perform both in case the first passes because of round-off
118
108
  let workPoint = this.projectPointToRay(other.origin);
119
- if (!other.origin.isAlmostEqualMetric(workPoint))
109
+ if (other.origin.distanceSquared(workPoint) > tol2)
120
110
  return false;
121
111
  workPoint = other.projectPointToRay(this.origin);
122
- if (!this.origin.isAlmostEqualMetric(workPoint))
112
+ if (this.origin.distanceSquared(workPoint) > tol2)
123
113
  return false;
124
114
  return true;
125
115
  }
@@ -366,41 +356,29 @@ export class Ray3d {
366
356
  */
367
357
  intersectionWithTriangle(vertex0, vertex1, vertex2, distanceTol, parameterTol, result) {
368
358
  /**
369
- * Suppose ray is shown by "rayOrigin + t*rayVector" and barycentric coordinate of point
359
+ * Let (w,u,v) be the barycentric coordinates of point P wrt the triangle (v0,v1,v2), such that
370
360
  * P = w*v0 + u*v1 + v*v2 = (1-u-v)*v0 + u*v1 + v*v2 = v0 + u*(v1-v0) + v*(v2-v0)
371
361
  *
372
- * Then if ray intersects triangle at a point we have
362
+ * Then if the ray given by rayOrigin + t*rayVector intersects the triangle at P, we have
373
363
  * v0 + u*(v1-v0) + v*(v2-v0) = rayOrigin + t*rayVector
374
- * or
375
- * -t*rayVector + u*(v1-v0) + v*(v2-v0) = rayOrigin - v0
376
364
  *
377
365
  * This equation can be reformulated as the following linear system:
378
366
  *
379
367
  * [ | | | ] [t] [ | ]
380
368
  * [-rayVector v1-v0 v2-v0] [u] = [rayOrigin - v0]
381
- * [ | | | ] [v] [ | ]
382
- *
383
- * Then to find t, u, and v use Cramer's Rule and also the fact that if matrix A = [c1,c2,c3], then
384
- * det(A) = c1.(c2 x c3) which leads to
385
- *
386
- * t = [(rayOrigin - v0).((v1-v0) x (v2-v0))] / [-rayVector.((v1-v0) x (v2-v0))]
387
- * u = [-rayVector.((rayOrigin - v0) x (v2-v0))] / [-rayVector.((v1-v0) x (v2-v0))]
388
- * v = [-rayVector.((v1-v0) x (rayOrigin - v0))] / [-rayVector.((v1-v0) x (v2-v0))]
369
+ * [ | | | ] [v] [ | ]
389
370
  *
390
- * Now note that swapping any 2 vectors c_i and c_j in formula c1.(c2 x c3) negates it. For example:
391
- * c1.(c2 x c3) = -c3.(c2 x c1) = c2.(c3 x c1)
371
+ * Then to find t, u, and v, use Cramer's Rule, the formulation of matrix determinant as column triple product,
372
+ * and the fact that swapping any 2 vectors in the triple product negates it:
392
373
  *
393
- * This leads to the final formulas used in the following code:
394
- * t = [(v2-v0).((rayOrigin - v0) x (v1-v0))] / [(v1-v0).(rayVector x (v2-v0))]
395
- * u = [(rayOrigin - v0).(rayVector x (v2-v0))] / [(v1-v0).(rayVector x (v2-v0))]
396
- * v = [-rayVector.((rayOrigin - v0) x (v1-v0))] / [(v1-v0).(rayVector x (v2-v0))]
374
+ * t = (v2-v0).(rayOrigin - v0) x (v1-v0) / (v1-v0).rayVector x (v2-v0)
375
+ * u = (rayOrigin - v0).rayVector x (v2-v0) / (v1-v0).rayVector x (v2-v0)
376
+ * v = -rayVector.(rayOrigin - v0) x (v1-v0) / (v1-v0).rayVector x (v2-v0)
397
377
  *
398
- * Note that we should verify 0 <= u,v,w <= 1. To do so we only need to check 0 <= u <= 1, 0 <= v, and u+v <= 1.
399
- * That's because w = 1-(u+v) and if we have those 4 checks, it's guaranteed that v <= 1 and 0 <= u+v and so
400
- * 0 <= w <= 1.
378
+ * Note that we verify 0 <= u,v,w <= 1. To do so we only need to check 0 <= u <= 1, 0 <= v, and u+v <= 1:
379
+ * these 4 checks guarantee that v <= 1 and 0 <= u+v, and so with w = 1-(u+v), we have 0 <= w <= 1.
401
380
  *
402
- * More info be found at
403
- * https://en.wikipedia.org/wiki/M%C3%B6ller%E2%80%93Trumbore_intersection_algorithm
381
+ * More info be found at https://en.wikipedia.org/wiki/Moller-Trumbore_intersection_algorithm.
404
382
  */
405
383
  if (distanceTol === undefined || distanceTol < 0) // we explicitly allow zero tolerance
406
384
  distanceTol = Geometry.smallMetricDistance;
@@ -1 +1 @@
1
- {"version":3,"file":"Ray3d.js","sourceRoot":"","sources":["../../../src/geometry3d/Ray3d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACpH,OAAO,EAAE,SAAS,EAAmB,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAW,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,qBAAqB;AACrB;;;;;;GAMG;AACH,MAAM,OAAO,KAAK;IAChB,qBAAqB;IACd,MAAM,CAAU;IACvB,0EAA0E;IACnE,SAAS,CAAW;IAC3B,0BAA0B;IACnB,CAAC,CAAU,CAAC,yBAAyB;IACpC,MAAM,CAAC,YAAY,CAAY;IAC/B,MAAM,CAAC,YAAY,CAAY;IAC/B,MAAM,CAAC,YAAY,CAAY;IAC/B,MAAM,CAAC,YAAY,CAAY;IAC/B,MAAM,CAAC,YAAY,CAAY;IAC/B,MAAM,CAAC,WAAW,CAAY;IACtC,oCAAoC;IACpC,YAAoB,MAA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C;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 { CurveCurveApproachType, CurveLocationDetail, CurveLocationDetailPair } from \"../curve/CurveLocationDetail\";\nimport { AxisOrder, BeJSONFunctions, Geometry } from \"../Geometry\";\nimport { SmallSystem } from \"../numerics/SmallSystem\";\nimport { Matrix3d } from \"./Matrix3d\";\nimport { Plane3dByOriginAndUnitNormal } from \"./Plane3dByOriginAndUnitNormal\";\nimport { Vector2d } from \"./Point2dVector2d\";\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\nimport { Range1d, Range3d } from \"./Range\";\nimport { Transform } from \"./Transform\";\nimport { XYAndZ } from \"./XYZProps\";\n\n// cspell:word Cramer\n/**\n * A Ray3d contains\n * * an `origin` point.\n * * a `direction` vector (The vector is not required to be normalized).\n * * an optional weight (number).\n * @public\n */\nexport class Ray3d implements BeJSONFunctions {\n /** The ray origin */\n public origin: Point3d;\n /** The ray direction. This is commonly (but not always) a unit vector. */\n public direction: Vector3d;\n /** Numeric annotation. */\n public a?: number; // optional (e.g. weight)\n private static _workVector0?: Vector3d;\n private static _workVector1?: Vector3d;\n private static _workVector2?: Vector3d;\n private static _workVector3?: Vector3d;\n private static _workVector4?: Vector3d;\n private static _workMatrix?: Matrix3d;\n // constructor (captures references)\n private constructor(origin: Point3d, direction: Vector3d) {\n this.origin = origin;\n this.direction = direction;\n this.a = undefined;\n }\n private static _create(x: number, y: number, z: number, u: number, v: number, w: number) {\n return new Ray3d(Point3d.create(x, y, z), Vector3d.create(u, v, w));\n }\n /** Create a ray on the x axis. */\n public static createXAxis(): Ray3d {\n return Ray3d._create(0, 0, 0, 1, 0, 0);\n }\n /** Create a ray on the y axis. */\n public static createYAxis(): Ray3d {\n return Ray3d._create(0, 0, 0, 0, 1, 0);\n }\n /** Create a ray on the z axis. */\n public static createZAxis(): Ray3d {\n return Ray3d._create(0, 0, 0, 0, 0, 1);\n }\n /** Create a ray with all zeros. */\n public static createZero(result?: Ray3d): Ray3d {\n if (result) {\n result.origin.setZero();\n result.direction.setZero();\n return result;\n }\n return new Ray3d(Point3d.createZero(), Vector3d.createZero());\n }\n /**\n * Test for nearly equal Ray3d objects.\n * * This tests for near equality of origin and direction -- i.e. member-by-member comparison.\n * * Use [[isAlmostEqualPointSet]] to allow origins to be anywhere along the common ray and to have to allow the\n * directions to be scaled or opposing.\n */\n public isAlmostEqual(other: Ray3d): boolean {\n return this.origin.isAlmostEqual(other.origin) && this.direction.isAlmostEqual(other.direction);\n }\n /**\n * Return the dot product of the ray's direction vector with a vector from the ray origin\n * to the `spacePoint`.\n * * If the instance is the unit normal of a plane, then this method returns the (signed) altitude\n * of `spacePoint` with respect to the plane.\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/ProjectVectorOnPlane\n */\n public dotProductToPoint(spacePoint: Point3d): number {\n return this.direction.dotProductStartEnd(this.origin, spacePoint);\n }\n /** Return the fractional coordinate (along the direction vector) of the `spacePoint` projected to the ray. */\n public pointToFraction(spacePoint: Point3d): number {\n return Geometry.safeDivideFraction(\n this.dotProductToPoint(spacePoint),\n this.direction.magnitudeSquared(),\n 0,\n );\n }\n /** Return the `spacePoint` projected onto the ray. */\n public projectPointToRay(spacePoint: Point3d): Point3d {\n /**\n * To project a point to the ray, we can create a vector called \"v\" from ray origin to the spacePoint and project\n * that vector to the ray direction vector \"r\". The projection is \"((v.r)/||r||^2) r\" where \"v.r\" is the dot\n * product. Note that pointToFraction returns \"(v.r)/||r||^2\".\n * Note: If r is the normal of a plane, then projection length \"(v.r)/||r||\" is the signed altitude of the\n * spacePoint with respect to the plane.\n */\n return this.origin.plusScaled(this.direction, this.pointToFraction(spacePoint));\n }\n /**\n * Test for nearly equal rays, allowing origin float and direction scaling.\n * * Use [[isAlmostEqual]] to require member-by-member comparison.\n */\n public isAlmostEqualPointSet(other: Ray3d): boolean {\n /**\n * This function tests two rays to determine if they define the same infinite lines.\n * So the origins can be different as long as they are on the infinite line (they can\n * \"float\") but the directions must be parallel or antiparallel.\n */\n if (!this.direction.isParallelTo(other.direction, true))\n return false;\n /**\n * In exact math, we consider a ray to have an infinite line as direction (not a finite vector).\n * Therefore, in exact math it is not possible for one origin to be on the other ray but not vice\n * versa. However, we test both ways because first check may pass due to round-off errors.\n */\n let workPoint = this.projectPointToRay(other.origin);\n if (!other.origin.isAlmostEqualMetric(workPoint))\n return false;\n workPoint = other.projectPointToRay(this.origin);\n if (!this.origin.isAlmostEqualMetric(workPoint))\n return false;\n return true;\n }\n /** Create a ray from origin and direction. */\n public static create(origin: Point3d, direction: Vector3d, result?: Ray3d): Ray3d {\n if (result) {\n result.set(origin, direction);\n return result;\n }\n return new Ray3d(origin.clone(), direction.clone());\n }\n /**\n * Given a homogeneous point and its derivative components, construct a Ray3d with cartesian\n * coordinates and derivatives.\n * @param weightedPoint `[x,y,z,w]` parts of weighted point.\n * @param weightedDerivative `[x,y,z,w]` derivatives\n * @param result\n */\n public static createWeightedDerivative(\n weightedPoint: Float64Array, weightedDerivative: Float64Array, result?: Ray3d,\n ): Ray3d | undefined {\n const w = weightedPoint[3];\n const dw = weightedDerivative[3];\n const x = weightedPoint[0];\n const y = weightedPoint[1];\n const z = weightedPoint[2];\n const dx = weightedDerivative[0] * w - weightedPoint[0] * dw;\n const dy = weightedDerivative[1] * w - weightedPoint[1] * dw;\n const dz = weightedDerivative[2] * w - weightedPoint[2] * dw;\n if (Geometry.isSmallMetricDistance(w))\n return undefined;\n const divW = 1.0 / w;\n const divWW = divW * divW;\n return Ray3d.createXYZUVW(\n x * divW, y * divW, z * divW,\n dx * divWW, dy * divWW, dz * divWW,\n result,\n );\n }\n /** Create from coordinates of the origin and direction. */\n public static createXYZUVW(\n originX: number, originY: number, originZ: number,\n directionX: number, directionY: number, directionZ: number,\n result?: Ray3d,\n ): Ray3d {\n if (result) {\n result.getOriginRef().set(originX, originY, originZ);\n result.getDirectionRef().set(directionX, directionY, directionZ);\n return result;\n }\n return new Ray3d(Point3d.create(originX, originY, originZ), Vector3d.create(directionX, directionY, directionZ));\n }\n /** Capture origin and direction in a new Ray3d. */\n public static createCapture(origin: Point3d, direction: Vector3d): Ray3d {\n return new Ray3d(origin, direction);\n }\n /** Create from (clones of) origin, direction, and numeric weight. */\n public static createPointVectorNumber(origin: Point3d, direction: Vector3d, a: number, result?: Ray3d): Ray3d {\n if (result) {\n result.origin.setFrom(origin);\n result.direction.setFrom(direction);\n result.a = a;\n return result;\n }\n result = new Ray3d(origin.clone(), direction.clone());\n result.a = a;\n return result;\n }\n /** Create from origin and target. The direction vector is the full length (non-unit) vector from origin to target. */\n public static createStartEnd(origin: Point3d, target: Point3d, result?: Ray3d): Ray3d {\n if (result) {\n result.origin.setFrom(origin);\n result.direction.setStartEnd(origin, target);\n return result;\n }\n return new Ray3d(origin.clone(), Vector3d.createStartEnd(origin, target));\n }\n /** Return a reference to the ray's origin. */\n public getOriginRef(): Point3d {\n return this.origin;\n }\n /** Return a reference to the ray's direction vector. */\n public getDirectionRef(): Vector3d {\n return this.direction;\n }\n /** Copy coordinates from origin and direction. */\n public set(origin: Point3d, direction: Vector3d): void {\n this.origin.setFrom(origin);\n this.direction.setFrom(direction);\n }\n /** Clone the ray. */\n public clone(result?: Ray3d): Ray3d {\n if (result) {\n result.set(this.origin.clone(), this.direction.clone());\n return result;\n }\n return new Ray3d(this.origin.clone(), this.direction.clone());\n }\n /** Return a clone of the transformed instance */\n public cloneTransformed(transform: Transform, result?: Ray3d): Ray3d {\n return Ray3d.create(\n transform.multiplyPoint3d(this.origin, result?.origin),\n transform.multiplyVector(this.direction, result?.direction),\n result,\n );\n }\n /** Create a clone and return the inverse transform of the clone. */\n public cloneInverseTransformed(transform: Transform, result?: Ray3d): Ray3d | undefined {\n if (!transform.computeCachedInverse(true))\n return undefined;\n return Ray3d.create(\n transform.multiplyInversePoint3d(this.origin, result?.origin)!,\n transform.matrix.multiplyInverseXYZAsVector3d(\n this.direction.x, this.direction.y, this.direction.z, result?.direction,\n )!,\n result,\n );\n }\n /** Apply a transform in place. */\n public transformInPlace(transform: Transform) {\n transform.multiplyPoint3d(this.origin, this.origin);\n transform.multiplyVector(this.direction, this.direction);\n }\n /** Copy data from another ray. */\n public setFrom(source: Ray3d): void {\n this.set(source.origin, source.direction);\n }\n /**\n * Return a point at fractional position along the ray.\n * * fraction 0 is the ray origin.\n * * fraction 1 is at the end of the direction vector when placed at the origin.\n */\n public fractionToPoint(fraction: number, result?: Point3d): Point3d {\n return this.origin.plusScaled(this.direction, fraction, result);\n }\n /**\n * Return a transform for rigid axes at ray origin with z in ray direction.\n * * If the direction vector is zero, axes default to identity (from [[Matrix3d.createRigidHeadsUp]])\n */\n public toRigidZFrame(result?: Transform): Transform {\n const axes = Ray3d._workMatrix = Matrix3d.createRigidHeadsUp(this.direction, AxisOrder.ZXY, Ray3d._workMatrix);\n return Transform.createOriginAndMatrix(this.origin, axes, result);\n }\n /** Convert {origin:[x,y,z], direction:[u,v,w]} to a Ray3d. */\n public setFromJSON(json?: any) {\n if (!json) {\n this.origin.set(0, 0, 0);\n this.direction.set(0, 0, 1);\n return;\n }\n this.origin.setFromJSON(json.origin);\n this.direction.setFromJSON(json.direction);\n }\n /**\n * Construct a JSON object from this Ray3d.\n * @return {*} [origin,normal]\n */\n public toJSON(): any {\n return { origin: this.origin.toJSON(), direction: this.direction.toJSON() };\n }\n /** Create a new ray from json object. See `setFromJSON` for json structure; */\n public static fromJSON(json?: any) {\n const result = Ray3d.createXAxis();\n result.setFromJSON(json);\n return result;\n }\n /**\n * Try to scale the direction vector to a given `magnitude`.\n * * Returns `false` if the ray direction is a zero vector.\n */\n public trySetDirectionMagnitudeInPlace(magnitude: number = 1.0): boolean {\n if (this.direction.tryNormalizeInPlace()) {\n this.direction.scaleInPlace(magnitude);\n return true;\n }\n this.direction.setZero();\n this.a = 0.0;\n return false;\n }\n /**\n * Normalize the ray direction in place.\n * * If parameter `a` is clearly nonzero and the direction vector can be normalized,\n * * Save the parameter `a` as the optional `a` member of the ray.\n * * Normalize the ray's direction vector.\n * * If parameter `a` is nearly zero,\n * * Set the `a` member to zero.\n * * Set the ray's direction vector to zero.\n * @param a value to be saved (e.g,. area).\n * @returns `true` if `a` is nonzero and normalization was successful. Otherwise, return `false`.\n */\n public tryNormalizeInPlaceWithAreaWeight(a: number): boolean {\n const tolerance = Geometry.smallMetricDistanceSquared;\n this.a = a;\n if (Math.abs(a) > tolerance && this.direction.tryNormalizeInPlace(tolerance))\n return true;\n this.direction.setZero();\n this.a = 0.0;\n return false;\n }\n /** Return distance from the ray to point in space. */\n public distance(spacePoint: Point3d): number {\n const uu = this.direction.magnitudeSquared();\n const uv = this.dotProductToPoint(spacePoint);\n const aa = Geometry.inverseMetricDistanceSquared(uu);\n if (aa)\n return Math.sqrt(this.origin.distanceSquared(spacePoint) - uv * uv * aa);\n else\n return Math.sqrt(this.origin.distanceSquared(spacePoint));\n }\n /**\n * Return the intersection parameter of the line defined by the ray with a `plane`.\n * * Stores the point of intersection in the `result` point (if passed as a parameter) and returns the parameter\n * along the ray where the intersection occurs. If we call the parameter 'f' then the point of intersection would\n * be `ray.origin + f * ray.direction`. Therefore:\n * * if ray intersects the plane at its origin, the function returns f = 0.\n * * if intersects at `ray.origin + ray.direction`, the function returns f = 1.\n * * if intersects behind the ray origin, the function returns f < 0.\n * * if intersects after `ray.origin + ray.direction`, the function returns f > 1.\n * * Returns `undefined` if the ray and plane are parallel or coplanar.\n */\n public intersectionWithPlane(plane: Plane3dByOriginAndUnitNormal, result?: Point3d): number | undefined {\n const vectorA = Vector3d.createStartEnd(plane.getOriginRef(), this.origin);\n const uDotN = this.direction.dotProduct(plane.getNormalRef());\n const nDotN = this.direction.magnitudeSquared();\n const aDotN = vectorA.dotProduct(plane.getNormalRef());\n const division = Geometry.conditionalDivideFraction(-aDotN, uDotN);\n if (undefined === division)\n return undefined;\n const division1 = Geometry.conditionalDivideFraction(nDotN, uDotN);\n if (undefined === division1)\n return undefined;\n if (result) {\n this.origin.plusScaled(this.direction, division, result);\n }\n return division;\n }\n /**\n * Find the intersection of the line defined by the ray with a Range3d.\n * * Return the range of parameters (on the ray) which are \"inside\" the range.\n * * Note that a range is always returned; if there is no intersection it is indicated by the test `result.isNull`.\n */\n public intersectionWithRange3d(range: Range3d, result?: Range1d): Range1d {\n if (range.isNull)\n return Range1d.createNull(result);\n const interval = Range1d.createXX(-Geometry.largeCoordinateResult, Geometry.largeCoordinateResult, result);\n if (interval.clipLinearMapToInterval(this.origin.x, this.direction.x, range.low.x, range.high.x)\n && interval.clipLinearMapToInterval(this.origin.y, this.direction.y, range.low.y, range.high.y)\n && interval.clipLinearMapToInterval(this.origin.z, this.direction.z, range.low.z, range.high.z)\n )\n return interval;\n return interval;\n }\n /**\n * Compute the intersection of the ray with a triangle.\n * * This method is faster than `BarycentricTriangle.intersectRay3d`.\n * @param vertex0 first vertex of the triangle\n * @param vertex1 second vertex of the triangle\n * @param vertex2 third vertex of the triangle\n * @param distanceTol optional tolerance used to check if ray is parallel to the triangle or if we have line\n * intersection but not ray intersection (if tolerance is not provided, Geometry.smallMetricDistance is used)\n * @param parameterTol optional tolerance used to allow intersections just beyond an edge/vertex in barycentric\n * coordinate space (if tolerance is not provided, Geometry.smallFloatingPoint is used)\n * @param result optional pre-allocated object to fill and return\n * @returns the intersection point if ray intersects the triangle. Otherwise, return undefined.\n */\n public intersectionWithTriangle(\n vertex0: Point3d, vertex1: Point3d, vertex2: Point3d, distanceTol?: number, parameterTol?: number, result?: Point3d,\n ): Point3d | undefined {\n /**\n * Suppose ray is shown by \"rayOrigin + t*rayVector\" and barycentric coordinate of point\n * P = w*v0 + u*v1 + v*v2 = (1-u-v)*v0 + u*v1 + v*v2 = v0 + u*(v1-v0) + v*(v2-v0)\n *\n * Then if ray intersects triangle at a point we have\n * v0 + u*(v1-v0) + v*(v2-v0) = rayOrigin + t*rayVector\n * or\n * -t*rayVector + u*(v1-v0) + v*(v2-v0) = rayOrigin - v0\n *\n * This equation can be reformulated as the following linear system:\n *\n * [ | | | ] [t] [ | ]\n * [-rayVector v1-v0 v2-v0] [u] = [rayOrigin - v0]\n * [ | | | ] [v] [ | ]\n *\n * Then to find t, u, and v use Cramer's Rule and also the fact that if matrix A = [c1,c2,c3], then\n * det(A) = c1.(c2 x c3) which leads to\n *\n * t = [(rayOrigin - v0).((v1-v0) x (v2-v0))] / [-rayVector.((v1-v0) x (v2-v0))]\n * u = [-rayVector.((rayOrigin - v0) x (v2-v0))] / [-rayVector.((v1-v0) x (v2-v0))]\n * v = [-rayVector.((v1-v0) x (rayOrigin - v0))] / [-rayVector.((v1-v0) x (v2-v0))]\n *\n * Now note that swapping any 2 vectors c_i and c_j in formula c1.(c2 x c3) negates it. For example:\n * c1.(c2 x c3) = -c3.(c2 x c1) = c2.(c3 x c1)\n *\n * This leads to the final formulas used in the following code:\n * t = [(v2-v0).((rayOrigin - v0) x (v1-v0))] / [(v1-v0).(rayVector x (v2-v0))]\n * u = [(rayOrigin - v0).(rayVector x (v2-v0))] / [(v1-v0).(rayVector x (v2-v0))]\n * v = [-rayVector.((rayOrigin - v0) x (v1-v0))] / [(v1-v0).(rayVector x (v2-v0))]\n *\n * Note that we should verify 0 <= u,v,w <= 1. To do so we only need to check 0 <= u <= 1, 0 <= v, and u+v <= 1.\n * That's because w = 1-(u+v) and if we have those 4 checks, it's guaranteed that v <= 1 and 0 <= u+v and so\n * 0 <= w <= 1.\n *\n * More info be found at\n * https://en.wikipedia.org/wiki/M%C3%B6ller%E2%80%93Trumbore_intersection_algorithm\n */\n if (distanceTol === undefined || distanceTol < 0) // we explicitly allow zero tolerance\n distanceTol = Geometry.smallMetricDistance;\n if (parameterTol === undefined || parameterTol < 0) // we explicitly allow zero tolerance\n parameterTol = Geometry.smallFloatingPoint;\n const edge1 = Ray3d._workVector0 = Vector3d.createStartEnd(vertex0, vertex1, Ray3d._workVector0);\n const edge2 = Ray3d._workVector1 = Vector3d.createStartEnd(vertex0, vertex2, Ray3d._workVector1);\n const h = Ray3d._workVector2 = this.direction.crossProduct(edge2, Ray3d._workVector2);\n const a = edge1.dotProduct(h);\n if (a >= -distanceTol && a <= distanceTol)\n return undefined; // ray is parallel to the triangle (includes coplanar case)\n const f = 1.0 / a;\n const s = Ray3d._workVector3 = Vector3d.createStartEnd(vertex0, this.origin, Ray3d._workVector3);\n let u = f * s.dotProduct(h);\n if (u < 0.0) {\n if (u >= -parameterTol)\n u = 0.0;\n else\n return undefined; // ray does not intersect the triangle\n } else if (u > 1.0) {\n if (u <= 1.0 + parameterTol)\n u = 1.0;\n else\n return undefined; // ray does not intersect the triangle\n }\n const q = Ray3d._workVector4 = s.crossProduct(edge1, Ray3d._workVector4);\n let v = f * this.direction.dotProduct(q);\n if (v < 0.0) {\n if (v >= -parameterTol)\n v = 0.0;\n else\n return undefined; // ray does not intersect the triangle\n } else if (u + v > 1.0 + parameterTol) {\n return undefined; // ray does not intersect the triangle\n }\n // at this stage, we know the line (parameterized as the ray) intersects the triangle\n const t = f * edge2.dotProduct(q);\n if (t < -distanceTol) // line intersection but not ray intersection\n return undefined;\n return this.origin.plusScaled(this.direction, t, result); // ray intersection\n }\n /**\n * Return the shortest vector `v` to `targetPoint` from the line defined by this ray.\n * * If the projection of `targetPoint` onto the line defined by this ray is q, then `v  = targetPoint - q`.\n */\n public perpendicularPartOfVectorToTarget(targetPoint: XYAndZ, result?: Vector3d): Vector3d {\n const vectorV = Vector3d.createStartEnd(this.origin, targetPoint);\n const uu = this.direction.magnitudeSquared();\n const uv = this.direction.dotProductStartEnd(this.origin, targetPoint);\n const fraction = Geometry.safeDivideFraction(uv, uu, 0.0);\n return vectorV.plusScaled(this.direction, -fraction, result);\n }\n /**\n * Determine if two rays intersect, or are fully overlapped, or parallel but not coincident, or skew.\n * * Return a CurveLocationDetailPair which contains fraction and point on each ray and has\n * annotation (in member `approachType`) indicating one of these relationships:\n * * CurveCurveApproachType.Intersection -- the rays have a simple intersection, at fractions indicated\n * in detailA and detailB\n * * CurveCurveApproachType.PerpendicularChord -- there is pair of where the rays have closest approach.\n * The rays are skew in space.\n * * CurveCurveApproachType.CoincidentGeometry -- the rays are the same unbounded line in space. The\n * fractions and points are a representative single common point.\n * * CurveCurveApproachType.Parallel -- the rays are parallel (and not coincident). The two points are\n * at the minimum distance\n */\n public static closestApproachRay3dRay3d(rayA: Ray3d, rayB: Ray3d): CurveLocationDetailPair {\n const intersectionFractions = Vector2d.create();\n let fractionA, fractionB;\n let pointA, pointB;\n let pairType;\n if (\n SmallSystem.ray3dXYZUVWClosestApproachUnbounded(\n rayA.origin.x, rayA.origin.y, rayA.origin.z, rayA.direction.x, rayA.direction.y, rayA.direction.z,\n rayB.origin.x, rayB.origin.y, rayB.origin.z, rayB.direction.x, rayB.direction.y, rayB.direction.z,\n intersectionFractions,\n )\n ) {\n fractionA = intersectionFractions.x;\n fractionB = intersectionFractions.y;\n pointA = rayA.fractionToPoint(fractionA);\n pointB = rayB.fractionToPoint(fractionB);\n pairType = pointA.isAlmostEqualMetric(pointB) ?\n CurveCurveApproachType.Intersection : CurveCurveApproachType.PerpendicularChord;\n } else {\n fractionB = 0.0;\n fractionA = rayA.pointToFraction(rayB.origin);\n pointA = rayA.fractionToPoint(fractionA);\n pointB = rayB.fractionToPoint(fractionB);\n pairType = pointA.isAlmostEqualMetric(pointB) ?\n CurveCurveApproachType.CoincidentGeometry : CurveCurveApproachType.ParallelGeometry;\n }\n const pair = CurveLocationDetailPair.createCapture(\n CurveLocationDetail.createRayFractionPoint(rayA, fractionA, rayA.fractionToPoint(fractionA)),\n CurveLocationDetail.createRayFractionPoint(rayB, fractionB, rayB.fractionToPoint(fractionB)));\n pair.approachType = pairType;\n return pair;\n }\n /**\n * Return a ray with `ray.origin` interpolated between `pt1` and `pt2` at the given `fraction`\n * and `ray.direction` set to the vector from `pt1` to `pt2` multiplied by the given `tangentScale`.\n * @param pt1 start point of the interpolation.\n * @param fraction fractional position between points.\n * @param pt2 end point of the interpolation.\n * @param tangentScale scale factor to apply to the startToEnd vector.\n * @param result optional receiver.\n */\n public static interpolatePointAndTangent(\n pt1: XYAndZ, fraction: number, pt2: XYAndZ, tangentScale: number, result?: Ray3d,\n ): Ray3d {\n result = result ?? Ray3d.createZero();\n const dx = pt2.x - pt1.x;\n const dy = pt2.y - pt1.y;\n const dz = pt2.z - pt1.z;\n result.direction.set(tangentScale * dx, tangentScale * dy, tangentScale * dz);\n if (fraction <= 0.5)\n result.origin.set(pt1.x + fraction * dx, pt1.y + fraction * dy, pt1.z + fraction * dz);\n else {\n const t: number = fraction - 1.0;\n result.origin.set(pt2.x + t * dx, pt2.y + t * dy, pt2.z + t * dz);\n }\n return result;\n }\n}\n"]}
1
+ {"version":3,"file":"Ray3d.js","sourceRoot":"","sources":["../../../src/geometry3d/Ray3d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACpH,OAAO,EAAE,SAAS,EAAmB,QAAQ,EAAuB,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAW,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,qBAAqB;AACrB;;;;;;GAMG;AACH,MAAM,OAAO,KAAK;IAChB,qBAAqB;IACd,MAAM,CAAU;IACvB,0EAA0E;IACnE,SAAS,CAAW;IAC3B,0BAA0B;IACnB,CAAC,CAAU,CAA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AAC,GAAG,QAAQ,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,QAAQ,GAAG,EAAE,CAAC,CAAC;aACpF,CAAC;YACJ,MAAM,CAAC,GAAW,QAAQ,GAAG,GAAG,CAAC;YACjC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;QACpE,CAAC;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 { CurveCurveApproachType, CurveLocationDetail, CurveLocationDetailPair } from \"../curve/CurveLocationDetail\";\nimport { AxisOrder, BeJSONFunctions, Geometry, PerpParallelOptions } from \"../Geometry\";\nimport { SmallSystem } from \"../numerics/SmallSystem\";\nimport { Matrix3d } from \"./Matrix3d\";\nimport { Plane3dByOriginAndUnitNormal } from \"./Plane3dByOriginAndUnitNormal\";\nimport { Vector2d } from \"./Point2dVector2d\";\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\nimport { Range1d, Range3d } from \"./Range\";\nimport { Transform } from \"./Transform\";\nimport { XYAndZ } from \"./XYZProps\";\n\n// cspell:word Cramer\n/**\n * A Ray3d contains\n * * an `origin` point.\n * * a `direction` vector (The vector is not required to be normalized).\n * * an optional weight (number).\n * @public\n */\nexport class Ray3d implements BeJSONFunctions {\n /** The ray origin */\n public origin: Point3d;\n /** The ray direction. This is commonly (but not always) a unit vector. */\n public direction: Vector3d;\n /** Numeric annotation. */\n public a?: number; // optional (e.g. weight)\n private static _workVector0?: Vector3d;\n private static _workVector1?: Vector3d;\n private static _workVector2?: Vector3d;\n private static _workVector3?: Vector3d;\n private static _workVector4?: Vector3d;\n private static _workMatrix?: Matrix3d;\n // constructor (captures references)\n private constructor(origin: Point3d, direction: Vector3d) {\n this.origin = origin;\n this.direction = direction;\n this.a = undefined;\n }\n private static _create(x: number, y: number, z: number, u: number, v: number, w: number) {\n return new Ray3d(Point3d.create(x, y, z), Vector3d.create(u, v, w));\n }\n /** Create a ray on the x axis. */\n public static createXAxis(): Ray3d {\n return Ray3d._create(0, 0, 0, 1, 0, 0);\n }\n /** Create a ray on the y axis. */\n public static createYAxis(): Ray3d {\n return Ray3d._create(0, 0, 0, 0, 1, 0);\n }\n /** Create a ray on the z axis. */\n public static createZAxis(): Ray3d {\n return Ray3d._create(0, 0, 0, 0, 0, 1);\n }\n /** Create a ray with all zeros. */\n public static createZero(result?: Ray3d): Ray3d {\n if (result) {\n result.origin.setZero();\n result.direction.setZero();\n return result;\n }\n return new Ray3d(Point3d.createZero(), Vector3d.createZero());\n }\n /**\n * Test for nearly equal Ray3d objects by comparing their origin and direction members.\n * @see [[isAlmostEqualPointSet]] to test for rays on the same infinite line.\n */\n public isAlmostEqual(other: Ray3d, tolerance: number = Geometry.smallMetricDistance): boolean {\n return this.origin.isAlmostEqual(other.origin, tolerance) && this.direction.isAlmostEqual(other.direction, tolerance);\n }\n /**\n * Return the dot product of the ray's direction vector with a vector from the ray origin\n * to the `spacePoint`.\n * * If the instance is the unit normal of a plane, then this method returns the (signed) altitude\n * of `spacePoint` with respect to the plane.\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/ProjectVectorOnPlane\n */\n public dotProductToPoint(spacePoint: Point3d): number {\n return this.direction.dotProductStartEnd(this.origin, spacePoint);\n }\n /** Return the fractional coordinate (along the direction vector) of the `spacePoint` projected to the ray. */\n public pointToFraction(spacePoint: Point3d): number {\n return Geometry.safeDivideFraction(\n this.dotProductToPoint(spacePoint),\n this.direction.magnitudeSquared(),\n 0,\n );\n }\n /** Return the `spacePoint` projected onto the ray. */\n public projectPointToRay(spacePoint: Point3d): Point3d {\n /**\n * To project a point to the ray, we can create a vector called \"v\" from ray origin to the spacePoint and project\n * that vector to the ray direction vector \"r\". The projection is \"((v.r)/||r||^2) r\" where \"v.r\" is the dot\n * product. Note that pointToFraction returns \"(v.r)/||r||^2\".\n * Note: If r is the normal of a plane, then projection length \"(v.r)/||r||\" is the signed altitude of the\n * spacePoint with respect to the plane.\n */\n return this.origin.plusScaled(this.direction, this.pointToFraction(spacePoint));\n }\n /**\n * Test for rays that describe the same infinite line.\n * @see [[isAlmostEqual]] for member-by-member comparison.\n */\n public isAlmostEqualPointSet(other: Ray3d, options?: PerpParallelOptions): boolean {\n if (!this.direction.isParallelTo(other.direction, true, false, options))\n return false;\n const tol2 = options?.distanceSquaredTol ?? Geometry.smallMetricDistanceSquared;\n // theoretically, one test below is sufficient, but perform both in case the first passes because of round-off\n let workPoint = this.projectPointToRay(other.origin);\n if (other.origin.distanceSquared(workPoint) > tol2)\n return false;\n workPoint = other.projectPointToRay(this.origin);\n if (this.origin.distanceSquared(workPoint) > tol2)\n return false;\n return true;\n }\n /** Create a ray from origin and direction. */\n public static create(origin: Point3d, direction: Vector3d, result?: Ray3d): Ray3d {\n if (result) {\n result.set(origin, direction);\n return result;\n }\n return new Ray3d(origin.clone(), direction.clone());\n }\n /**\n * Given a homogeneous point and its derivative components, construct a Ray3d with cartesian\n * coordinates and derivatives.\n * @param weightedPoint `[x,y,z,w]` parts of weighted point.\n * @param weightedDerivative `[x,y,z,w]` derivatives\n * @param result\n */\n public static createWeightedDerivative(\n weightedPoint: Float64Array, weightedDerivative: Float64Array, result?: Ray3d,\n ): Ray3d | undefined {\n const w = weightedPoint[3];\n const dw = weightedDerivative[3];\n const x = weightedPoint[0];\n const y = weightedPoint[1];\n const z = weightedPoint[2];\n const dx = weightedDerivative[0] * w - weightedPoint[0] * dw;\n const dy = weightedDerivative[1] * w - weightedPoint[1] * dw;\n const dz = weightedDerivative[2] * w - weightedPoint[2] * dw;\n if (Geometry.isSmallMetricDistance(w))\n return undefined;\n const divW = 1.0 / w;\n const divWW = divW * divW;\n return Ray3d.createXYZUVW(\n x * divW, y * divW, z * divW,\n dx * divWW, dy * divWW, dz * divWW,\n result,\n );\n }\n /** Create from coordinates of the origin and direction. */\n public static createXYZUVW(\n originX: number, originY: number, originZ: number,\n directionX: number, directionY: number, directionZ: number,\n result?: Ray3d,\n ): Ray3d {\n if (result) {\n result.getOriginRef().set(originX, originY, originZ);\n result.getDirectionRef().set(directionX, directionY, directionZ);\n return result;\n }\n return new Ray3d(Point3d.create(originX, originY, originZ), Vector3d.create(directionX, directionY, directionZ));\n }\n /** Capture origin and direction in a new Ray3d. */\n public static createCapture(origin: Point3d, direction: Vector3d): Ray3d {\n return new Ray3d(origin, direction);\n }\n /** Create from (clones of) origin, direction, and numeric weight. */\n public static createPointVectorNumber(origin: Point3d, direction: Vector3d, a: number, result?: Ray3d): Ray3d {\n if (result) {\n result.origin.setFrom(origin);\n result.direction.setFrom(direction);\n result.a = a;\n return result;\n }\n result = new Ray3d(origin.clone(), direction.clone());\n result.a = a;\n return result;\n }\n /** Create from origin and target. The direction vector is the full length (non-unit) vector from origin to target. */\n public static createStartEnd(origin: Point3d, target: Point3d, result?: Ray3d): Ray3d {\n if (result) {\n result.origin.setFrom(origin);\n result.direction.setStartEnd(origin, target);\n return result;\n }\n return new Ray3d(origin.clone(), Vector3d.createStartEnd(origin, target));\n }\n /** Return a reference to the ray's origin. */\n public getOriginRef(): Point3d {\n return this.origin;\n }\n /** Return a reference to the ray's direction vector. */\n public getDirectionRef(): Vector3d {\n return this.direction;\n }\n /** Copy coordinates from origin and direction. */\n public set(origin: Point3d, direction: Vector3d): void {\n this.origin.setFrom(origin);\n this.direction.setFrom(direction);\n }\n /** Clone the ray. */\n public clone(result?: Ray3d): Ray3d {\n if (result) {\n result.set(this.origin.clone(), this.direction.clone());\n return result;\n }\n return new Ray3d(this.origin.clone(), this.direction.clone());\n }\n /** Return a clone of the transformed instance */\n public cloneTransformed(transform: Transform, result?: Ray3d): Ray3d {\n return Ray3d.create(\n transform.multiplyPoint3d(this.origin, result?.origin),\n transform.multiplyVector(this.direction, result?.direction),\n result,\n );\n }\n /** Create a clone and return the inverse transform of the clone. */\n public cloneInverseTransformed(transform: Transform, result?: Ray3d): Ray3d | undefined {\n if (!transform.computeCachedInverse(true))\n return undefined;\n return Ray3d.create(\n transform.multiplyInversePoint3d(this.origin, result?.origin)!,\n transform.matrix.multiplyInverseXYZAsVector3d(\n this.direction.x, this.direction.y, this.direction.z, result?.direction,\n )!,\n result,\n );\n }\n /** Apply a transform in place. */\n public transformInPlace(transform: Transform) {\n transform.multiplyPoint3d(this.origin, this.origin);\n transform.multiplyVector(this.direction, this.direction);\n }\n /** Copy data from another ray. */\n public setFrom(source: Ray3d): void {\n this.set(source.origin, source.direction);\n }\n /**\n * Return a point at fractional position along the ray.\n * * fraction 0 is the ray origin.\n * * fraction 1 is at the end of the direction vector when placed at the origin.\n */\n public fractionToPoint(fraction: number, result?: Point3d): Point3d {\n return this.origin.plusScaled(this.direction, fraction, result);\n }\n /**\n * Return a transform for rigid axes at ray origin with z in ray direction.\n * * If the direction vector is zero, axes default to identity (from [[Matrix3d.createRigidHeadsUp]])\n */\n public toRigidZFrame(result?: Transform): Transform {\n const axes = Ray3d._workMatrix = Matrix3d.createRigidHeadsUp(this.direction, AxisOrder.ZXY, Ray3d._workMatrix);\n return Transform.createOriginAndMatrix(this.origin, axes, result);\n }\n /** Convert {origin:[x,y,z], direction:[u,v,w]} to a Ray3d. */\n public setFromJSON(json?: any) {\n if (!json) {\n this.origin.set(0, 0, 0);\n this.direction.set(0, 0, 1);\n return;\n }\n this.origin.setFromJSON(json.origin);\n this.direction.setFromJSON(json.direction);\n }\n /**\n * Construct a JSON object from this Ray3d.\n * @return {*} [origin,normal]\n */\n public toJSON(): any {\n return { origin: this.origin.toJSON(), direction: this.direction.toJSON() };\n }\n /** Create a new ray from json object. See `setFromJSON` for json structure; */\n public static fromJSON(json?: any) {\n const result = Ray3d.createXAxis();\n result.setFromJSON(json);\n return result;\n }\n /**\n * Try to scale the direction vector to a given `magnitude`.\n * * Returns `false` if the ray direction is a zero vector.\n */\n public trySetDirectionMagnitudeInPlace(magnitude: number = 1.0): boolean {\n if (this.direction.tryNormalizeInPlace()) {\n this.direction.scaleInPlace(magnitude);\n return true;\n }\n this.direction.setZero();\n this.a = 0.0;\n return false;\n }\n /**\n * Normalize the ray direction in place.\n * * If parameter `a` is clearly nonzero and the direction vector can be normalized,\n * * Save the parameter `a` as the optional `a` member of the ray.\n * * Normalize the ray's direction vector.\n * * If parameter `a` is nearly zero,\n * * Set the `a` member to zero.\n * * Set the ray's direction vector to zero.\n * @param a value to be saved (e.g,. area).\n * @returns `true` if `a` is nonzero and normalization was successful. Otherwise, return `false`.\n */\n public tryNormalizeInPlaceWithAreaWeight(a: number): boolean {\n const tolerance = Geometry.smallMetricDistanceSquared;\n this.a = a;\n if (Math.abs(a) > tolerance && this.direction.tryNormalizeInPlace(tolerance))\n return true;\n this.direction.setZero();\n this.a = 0.0;\n return false;\n }\n /** Return distance from the ray to point in space. */\n public distance(spacePoint: Point3d): number {\n const uu = this.direction.magnitudeSquared();\n const uv = this.dotProductToPoint(spacePoint);\n const aa = Geometry.inverseMetricDistanceSquared(uu);\n if (aa)\n return Math.sqrt(this.origin.distanceSquared(spacePoint) - uv * uv * aa);\n else\n return Math.sqrt(this.origin.distanceSquared(spacePoint));\n }\n /**\n * Return the intersection parameter of the line defined by the ray with a `plane`.\n * * Stores the point of intersection in the `result` point (if passed as a parameter) and returns the parameter\n * along the ray where the intersection occurs. If we call the parameter 'f' then the point of intersection would\n * be `ray.origin + f * ray.direction`. Therefore:\n * * if ray intersects the plane at its origin, the function returns f = 0.\n * * if intersects at `ray.origin + ray.direction`, the function returns f = 1.\n * * if intersects behind the ray origin, the function returns f < 0.\n * * if intersects after `ray.origin + ray.direction`, the function returns f > 1.\n * * Returns `undefined` if the ray and plane are parallel or coplanar.\n */\n public intersectionWithPlane(plane: Plane3dByOriginAndUnitNormal, result?: Point3d): number | undefined {\n const vectorA = Vector3d.createStartEnd(plane.getOriginRef(), this.origin);\n const uDotN = this.direction.dotProduct(plane.getNormalRef());\n const nDotN = this.direction.magnitudeSquared();\n const aDotN = vectorA.dotProduct(plane.getNormalRef());\n const division = Geometry.conditionalDivideFraction(-aDotN, uDotN);\n if (undefined === division)\n return undefined;\n const division1 = Geometry.conditionalDivideFraction(nDotN, uDotN);\n if (undefined === division1)\n return undefined;\n if (result) {\n this.origin.plusScaled(this.direction, division, result);\n }\n return division;\n }\n /**\n * Find the intersection of the line defined by the ray with a Range3d.\n * * Return the range of parameters (on the ray) which are \"inside\" the range.\n * * Note that a range is always returned; if there is no intersection it is indicated by the test `result.isNull`.\n */\n public intersectionWithRange3d(range: Range3d, result?: Range1d): Range1d {\n if (range.isNull)\n return Range1d.createNull(result);\n const interval = Range1d.createXX(-Geometry.largeCoordinateResult, Geometry.largeCoordinateResult, result);\n if (interval.clipLinearMapToInterval(this.origin.x, this.direction.x, range.low.x, range.high.x)\n && interval.clipLinearMapToInterval(this.origin.y, this.direction.y, range.low.y, range.high.y)\n && interval.clipLinearMapToInterval(this.origin.z, this.direction.z, range.low.z, range.high.z)\n )\n return interval;\n return interval;\n }\n /**\n * Compute the intersection of the ray with a triangle.\n * * This method is faster than `BarycentricTriangle.intersectRay3d`.\n * @param vertex0 first vertex of the triangle\n * @param vertex1 second vertex of the triangle\n * @param vertex2 third vertex of the triangle\n * @param distanceTol optional tolerance used to check if ray is parallel to the triangle or if we have line\n * intersection but not ray intersection (if tolerance is not provided, Geometry.smallMetricDistance is used)\n * @param parameterTol optional tolerance used to allow intersections just beyond an edge/vertex in barycentric\n * coordinate space (if tolerance is not provided, Geometry.smallFloatingPoint is used)\n * @param result optional pre-allocated object to fill and return\n * @returns the intersection point if ray intersects the triangle. Otherwise, return undefined.\n */\n public intersectionWithTriangle(\n vertex0: Point3d, vertex1: Point3d, vertex2: Point3d, distanceTol?: number, parameterTol?: number, result?: Point3d,\n ): Point3d | undefined {\n /**\n * Let (w,u,v) be the barycentric coordinates of point P wrt the triangle (v0,v1,v2), such that\n * P = w*v0 + u*v1 + v*v2 = (1-u-v)*v0 + u*v1 + v*v2 = v0 + u*(v1-v0) + v*(v2-v0)\n *\n * Then if the ray given by rayOrigin + t*rayVector intersects the triangle at P, we have\n * v0 + u*(v1-v0) + v*(v2-v0) = rayOrigin + t*rayVector\n *\n * This equation can be reformulated as the following linear system:\n *\n * [ | | | ] [t] [ | ]\n * [-rayVector v1-v0 v2-v0] [u] = [rayOrigin - v0]\n * [ | | | ] [v] [ | ]\n *\n * Then to find t, u, and v, use Cramer's Rule, the formulation of matrix determinant as column triple product,\n * and the fact that swapping any 2 vectors in the triple product negates it:\n *\n * t = (v2-v0).(rayOrigin - v0) x (v1-v0) / (v1-v0).rayVector x (v2-v0)\n * u = (rayOrigin - v0).rayVector x (v2-v0) / (v1-v0).rayVector x (v2-v0)\n * v = -rayVector.(rayOrigin - v0) x (v1-v0) / (v1-v0).rayVector x (v2-v0)\n *\n * Note that we verify 0 <= u,v,w <= 1. To do so we only need to check 0 <= u <= 1, 0 <= v, and u+v <= 1:\n * these 4 checks guarantee that v <= 1 and 0 <= u+v, and so with w = 1-(u+v), we have 0 <= w <= 1.\n *\n * More info be found at https://en.wikipedia.org/wiki/Moller-Trumbore_intersection_algorithm.\n */\n if (distanceTol === undefined || distanceTol < 0) // we explicitly allow zero tolerance\n distanceTol = Geometry.smallMetricDistance;\n if (parameterTol === undefined || parameterTol < 0) // we explicitly allow zero tolerance\n parameterTol = Geometry.smallFloatingPoint;\n const edge1 = Ray3d._workVector0 = Vector3d.createStartEnd(vertex0, vertex1, Ray3d._workVector0);\n const edge2 = Ray3d._workVector1 = Vector3d.createStartEnd(vertex0, vertex2, Ray3d._workVector1);\n const h = Ray3d._workVector2 = this.direction.crossProduct(edge2, Ray3d._workVector2);\n const a = edge1.dotProduct(h);\n if (a >= -distanceTol && a <= distanceTol)\n return undefined; // ray is parallel to the triangle (includes coplanar case)\n const f = 1.0 / a;\n const s = Ray3d._workVector3 = Vector3d.createStartEnd(vertex0, this.origin, Ray3d._workVector3);\n let u = f * s.dotProduct(h);\n if (u < 0.0) {\n if (u >= -parameterTol)\n u = 0.0;\n else\n return undefined; // ray does not intersect the triangle\n } else if (u > 1.0) {\n if (u <= 1.0 + parameterTol)\n u = 1.0;\n else\n return undefined; // ray does not intersect the triangle\n }\n const q = Ray3d._workVector4 = s.crossProduct(edge1, Ray3d._workVector4);\n let v = f * this.direction.dotProduct(q);\n if (v < 0.0) {\n if (v >= -parameterTol)\n v = 0.0;\n else\n return undefined; // ray does not intersect the triangle\n } else if (u + v > 1.0 + parameterTol) {\n return undefined; // ray does not intersect the triangle\n }\n // at this stage, we know the line (parameterized as the ray) intersects the triangle\n const t = f * edge2.dotProduct(q);\n if (t < -distanceTol) // line intersection but not ray intersection\n return undefined;\n return this.origin.plusScaled(this.direction, t, result); // ray intersection\n }\n /**\n * Return the shortest vector `v` to `targetPoint` from the line defined by this ray.\n * * If the projection of `targetPoint` onto the line defined by this ray is q, then `v  = targetPoint - q`.\n */\n public perpendicularPartOfVectorToTarget(targetPoint: XYAndZ, result?: Vector3d): Vector3d {\n const vectorV = Vector3d.createStartEnd(this.origin, targetPoint);\n const uu = this.direction.magnitudeSquared();\n const uv = this.direction.dotProductStartEnd(this.origin, targetPoint);\n const fraction = Geometry.safeDivideFraction(uv, uu, 0.0);\n return vectorV.plusScaled(this.direction, -fraction, result);\n }\n /**\n * Determine if two rays intersect, or are fully overlapped, or parallel but not coincident, or skew.\n * * Return a CurveLocationDetailPair which contains fraction and point on each ray and has\n * annotation (in member `approachType`) indicating one of these relationships:\n * * CurveCurveApproachType.Intersection -- the rays have a simple intersection, at fractions indicated\n * in detailA and detailB\n * * CurveCurveApproachType.PerpendicularChord -- there is pair of where the rays have closest approach.\n * The rays are skew in space.\n * * CurveCurveApproachType.CoincidentGeometry -- the rays are the same unbounded line in space. The\n * fractions and points are a representative single common point.\n * * CurveCurveApproachType.Parallel -- the rays are parallel (and not coincident). The two points are\n * at the minimum distance\n */\n public static closestApproachRay3dRay3d(rayA: Ray3d, rayB: Ray3d): CurveLocationDetailPair {\n const intersectionFractions = Vector2d.create();\n let fractionA, fractionB;\n let pointA, pointB;\n let pairType;\n if (\n SmallSystem.ray3dXYZUVWClosestApproachUnbounded(\n rayA.origin.x, rayA.origin.y, rayA.origin.z, rayA.direction.x, rayA.direction.y, rayA.direction.z,\n rayB.origin.x, rayB.origin.y, rayB.origin.z, rayB.direction.x, rayB.direction.y, rayB.direction.z,\n intersectionFractions,\n )\n ) {\n fractionA = intersectionFractions.x;\n fractionB = intersectionFractions.y;\n pointA = rayA.fractionToPoint(fractionA);\n pointB = rayB.fractionToPoint(fractionB);\n pairType = pointA.isAlmostEqualMetric(pointB) ?\n CurveCurveApproachType.Intersection : CurveCurveApproachType.PerpendicularChord;\n } else {\n fractionB = 0.0;\n fractionA = rayA.pointToFraction(rayB.origin);\n pointA = rayA.fractionToPoint(fractionA);\n pointB = rayB.fractionToPoint(fractionB);\n pairType = pointA.isAlmostEqualMetric(pointB) ?\n CurveCurveApproachType.CoincidentGeometry : CurveCurveApproachType.ParallelGeometry;\n }\n const pair = CurveLocationDetailPair.createCapture(\n CurveLocationDetail.createRayFractionPoint(rayA, fractionA, rayA.fractionToPoint(fractionA)),\n CurveLocationDetail.createRayFractionPoint(rayB, fractionB, rayB.fractionToPoint(fractionB)));\n pair.approachType = pairType;\n return pair;\n }\n /**\n * Return a ray with `ray.origin` interpolated between `pt1` and `pt2` at the given `fraction`\n * and `ray.direction` set to the vector from `pt1` to `pt2` multiplied by the given `tangentScale`.\n * @param pt1 start point of the interpolation.\n * @param fraction fractional position between points.\n * @param pt2 end point of the interpolation.\n * @param tangentScale scale factor to apply to the startToEnd vector.\n * @param result optional receiver.\n */\n public static interpolatePointAndTangent(\n pt1: XYAndZ, fraction: number, pt2: XYAndZ, tangentScale: number, result?: Ray3d,\n ): Ray3d {\n result = result ?? Ray3d.createZero();\n const dx = pt2.x - pt1.x;\n const dy = pt2.y - pt1.y;\n const dz = pt2.z - pt1.z;\n result.direction.set(tangentScale * dx, tangentScale * dy, tangentScale * dz);\n if (fraction <= 0.5)\n result.origin.set(pt1.x + fraction * dx, pt1.y + fraction * dy, pt1.z + fraction * dz);\n else {\n const t: number = fraction - 1.0;\n result.origin.set(pt2.x + t * dx, pt2.y + t * dy, pt2.z + t * dz);\n }\n return result;\n }\n}\n"]}
@@ -1,55 +1,65 @@
1
- import { GrowableXYZArray } from "./GrowableXYZArray";
2
- import { IndexedXYZCollection } from "./IndexedXYZCollection";
3
1
  /** @packageDocumentation
4
2
  * @module ArraysAndInterfaces
5
3
  */
4
+ import { GrowableXYZArray } from "./GrowableXYZArray";
5
+ import { IndexedXYZCollection } from "./IndexedXYZCollection";
6
6
  /**
7
- * abstract class managing an array of objects of type T, available for reuse by trusted callers.
8
- * * Derived class must implement these methods:
9
- * * `createForCache()` -- create a new, ready-to-use object
10
- * * `clearForCache (data: T)` -- tidy up `data` so it can be reused.
11
- * @internal
7
+ * Abstract class managing an array of objects of type T, available for reuse by trusted callers.
8
+ * * Derived class must implement `createForCache` and `clearForCache`.
9
+ * @public
12
10
  */
13
11
  export declare abstract class ReusableObjectCache<T> {
14
- protected abstract clearForCache(data: T): void;
15
- protected abstract createForCache(): T;
16
12
  private _cachedObjects;
17
- numDrop: number;
18
- numCreate: number;
19
- numReuse: number;
13
+ private _numDrop;
14
+ private _numCreate;
15
+ private _numReuse;
20
16
  /**
21
- * create a new cache for objects of type T
17
+ * Create a new cache for objects of type T.
22
18
  */
23
19
  protected constructor();
24
- /** Present `data` for storage in the cache, and hence reuse by any subsequent `grabFromCache`
25
- * * `data` will be sent to `clearForCache`.
26
- * * caller should never refer to this instance again.
20
+ /** Create a new, ready-to-use object. */
21
+ protected abstract createForCache(): T;
22
+ /** Tidy up `data` so it can be reused. */
23
+ protected abstract clearForCache(data: T): void;
24
+ /**
25
+ * Present `data` for storage in the cache, and hence reuse by any subsequent [[grabFromCache]].
26
+ * * `data` will be sent to [[clearForCache]].
27
+ * * The caller should never refer to `data` again.
28
+ * @param data object to return to the cache.
27
29
  */
28
30
  dropToCache(data: T | undefined): void;
29
31
  /**
30
- * grab an object from the cache.
31
- * * The returned object becomes property of the caller.
32
- * * That is, the cache does not remember it for any further management
33
- * @param data
32
+ * Grab an object from the cache.
33
+ * * The returned object becomes property of the caller: the cache does not remember it for any further management.
34
34
  */
35
35
  grabFromCache(): T;
36
- /** Drop all entries of data[] to the cache.
37
- * @param data on input, the data to drop. on output, data is an empty array.
36
+ /**
37
+ * Drop multiple objects to the cache.
38
+ * @param data on input, the data to drop. On output, data is an empty array.
38
39
  */
39
40
  dropAllToCache(data: T[]): void;
40
41
  }
41
42
  /**
42
- * Cache of GrowableXYZArray.
43
- * Intended for use by (for instance) clipping methods that can be structured to have disciplined reuse of a small number of arrays for a large number of steps.
44
- * @internal
43
+ * Cache of [[GrowableXYZArray]].
44
+ * * Example usage includes clipping methods that can be structured to have disciplined reuse of a small number of arrays for a large number of steps.
45
+ * @public
45
46
  */
46
47
  export declare class GrowableXYZArrayCache extends ReusableObjectCache<GrowableXYZArray> {
47
- protected clearForCache(data: GrowableXYZArray): void;
48
- protected createForCache(): GrowableXYZArray;
48
+ /**
49
+ * Create a new cache for [[GrowableXYZArray]] objects.
50
+ */
49
51
  constructor();
50
52
  /**
51
- * Grab an array from the cache and immediately fill from a source
52
- * @param source
53
+ * Create a new, ready-to-use [[GrowableXYZArray]].
54
+ * @param numPoints initial capacity in xyz triples (default 10)
55
+ * @param growthFactor reallocation expansion (default 1.5)
56
+ */
57
+ protected createForCache(numPoints?: number, growthFactor?: number): GrowableXYZArray;
58
+ /** Tidy up `data` so it can be reused. */
59
+ protected clearForCache(data: GrowableXYZArray): void;
60
+ /**
61
+ * Grab an array from the cache and immediately fill from a source.
62
+ * @param source xyz to copy into the returned array.
53
63
  */
54
64
  grabAndFill(source: IndexedXYZCollection): GrowableXYZArray;
55
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ReusableObjectCache.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/ReusableObjectCache.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;GAEG;AACH;;;;;;GAMG;AACH,8BAAsB,mBAAmB,CAAC,CAAC;IACzC,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI;IAC/C,SAAS,CAAC,QAAQ,CAAC,cAAc,IAAI,CAAC;IACtC,OAAO,CAAC,cAAc,CAAM;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,SAAS;IAMT;;;OAGG;IACI,WAAW,CAAC,IAAI,EAAE,CAAC,GAAG,SAAS;IAOtC;;;;;OAKG;IACI,aAAa,IAAI,CAAC;IAUzB;;OAEG;IACI,cAAc,CAAC,IAAI,EAAE,CAAC,EAAE;CAKhC;AACD;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,mBAAmB,CAAC,gBAAgB,CAAC;IAC9E,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;IACrD,SAAS,CAAC,cAAc,IAAI,gBAAgB;;IAE5C;;;OAGG;IACI,WAAW,CAAC,MAAM,EAAE,oBAAoB,GAAG,gBAAgB;CAMnE"}
1
+ {"version":3,"file":"ReusableObjectCache.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/ReusableObjectCache.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,C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