@itwin/core-geometry 3.5.0-dev.8 → 3.6.0-dev.1

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 (342) hide show
  1. package/CHANGELOG.md +65 -1
  2. package/lib/cjs/Geometry.d.ts +26 -10
  3. package/lib/cjs/Geometry.d.ts.map +1 -1
  4. package/lib/cjs/Geometry.js +32 -17
  5. package/lib/cjs/Geometry.js.map +1 -1
  6. package/lib/cjs/bspline/BSplineCurve.d.ts +11 -5
  7. package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
  8. package/lib/cjs/bspline/BSplineCurve.js +47 -18
  9. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  10. package/lib/cjs/bspline/BezierCurveBase.d.ts +10 -3
  11. package/lib/cjs/bspline/BezierCurveBase.d.ts.map +1 -1
  12. package/lib/cjs/bspline/BezierCurveBase.js +12 -4
  13. package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
  14. package/lib/cjs/bspline/InterpolationCurve3d.d.ts.map +1 -1
  15. package/lib/cjs/bspline/InterpolationCurve3d.js +4 -1
  16. package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
  17. package/lib/cjs/bspline/KnotVector.d.ts.map +1 -1
  18. package/lib/cjs/bspline/KnotVector.js +3 -0
  19. package/lib/cjs/bspline/KnotVector.js.map +1 -1
  20. package/lib/cjs/curve/Arc3d.d.ts +10 -4
  21. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  22. package/lib/cjs/curve/Arc3d.js +17 -5
  23. package/lib/cjs/curve/Arc3d.js.map +1 -1
  24. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +15 -7
  25. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  26. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +46 -29
  27. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  28. package/lib/cjs/curve/CurveCollection.d.ts +13 -4
  29. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  30. package/lib/cjs/curve/CurveCollection.js +23 -2
  31. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  32. package/lib/cjs/curve/CurveCurveIntersectXY.js +1 -1
  33. package/lib/cjs/curve/CurveCurveIntersectXY.js.map +1 -1
  34. package/lib/cjs/curve/CurveCurveIntersectXYZ.d.ts +4 -3
  35. package/lib/cjs/curve/CurveCurveIntersectXYZ.d.ts.map +1 -1
  36. package/lib/cjs/curve/CurveCurveIntersectXYZ.js +8 -6
  37. package/lib/cjs/curve/CurveCurveIntersectXYZ.js.map +1 -1
  38. package/lib/cjs/curve/CurvePrimitive.d.ts +20 -18
  39. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  40. package/lib/cjs/curve/CurvePrimitive.js +58 -339
  41. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  42. package/lib/cjs/curve/LineSegment3d.d.ts +8 -2
  43. package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
  44. package/lib/cjs/curve/LineSegment3d.js +9 -0
  45. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  46. package/lib/cjs/curve/LineString3d.d.ts +18 -2
  47. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  48. package/lib/cjs/curve/LineString3d.js +39 -23
  49. package/lib/cjs/curve/LineString3d.js.map +1 -1
  50. package/lib/cjs/curve/ProxyCurve.d.ts +9 -7
  51. package/lib/cjs/curve/ProxyCurve.d.ts.map +1 -1
  52. package/lib/cjs/curve/ProxyCurve.js +4 -0
  53. package/lib/cjs/curve/ProxyCurve.js.map +1 -1
  54. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +2 -1
  55. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  56. package/lib/cjs/curve/Query/PlanarSubdivision.js +5 -4
  57. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  58. package/lib/cjs/curve/RegionOps.d.ts +5 -0
  59. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  60. package/lib/cjs/curve/RegionOps.js +17 -3
  61. package/lib/cjs/curve/RegionOps.js.map +1 -1
  62. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts +9 -6
  63. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  64. package/lib/cjs/curve/RegionOpsClassificationSweeps.js +55 -47
  65. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  66. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts +55 -0
  67. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts.map +1 -0
  68. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js +143 -0
  69. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -0
  70. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts +43 -0
  71. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -0
  72. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js +146 -0
  73. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -0
  74. package/lib/cjs/curve/internalContexts/CurveLengthContext.d.ts +33 -0
  75. package/lib/cjs/curve/internalContexts/CurveLengthContext.d.ts.map +1 -0
  76. package/lib/cjs/curve/internalContexts/CurveLengthContext.js +91 -0
  77. package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -0
  78. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts +21 -0
  79. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts.map +1 -0
  80. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js +34 -0
  81. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -0
  82. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +31 -8
  83. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
  84. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js +77 -12
  85. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  86. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts +2 -2
  87. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  88. package/lib/cjs/curve/spiral/DirectSpiral3d.js +15 -8
  89. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  90. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts +12 -7
  91. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  92. package/lib/cjs/curve/spiral/TransitionSpiral3d.js +12 -3
  93. package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
  94. package/lib/cjs/geometry3d/Angle.d.ts +66 -42
  95. package/lib/cjs/geometry3d/Angle.d.ts.map +1 -1
  96. package/lib/cjs/geometry3d/Angle.js +201 -99
  97. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  98. package/lib/cjs/geometry3d/AngleSweep.d.ts +102 -60
  99. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  100. package/lib/cjs/geometry3d/AngleSweep.js +191 -106
  101. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  102. package/lib/cjs/geometry3d/Matrix3d.d.ts +25 -8
  103. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  104. package/lib/cjs/geometry3d/Matrix3d.js +67 -15
  105. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  106. package/lib/cjs/geometry3d/Point2dArrayCarrier.d.ts +1 -0
  107. package/lib/cjs/geometry3d/Point2dArrayCarrier.d.ts.map +1 -1
  108. package/lib/cjs/geometry3d/Point2dArrayCarrier.js +2 -1
  109. package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
  110. package/lib/cjs/geometry3d/Point2dVector2d.d.ts +86 -25
  111. package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
  112. package/lib/cjs/geometry3d/Point2dVector2d.js +230 -81
  113. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  114. package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts +14 -4
  115. package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  116. package/lib/cjs/geometry3d/Point3dArrayCarrier.js +15 -5
  117. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  118. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +121 -67
  119. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  120. package/lib/cjs/geometry3d/Point3dVector3d.js +318 -137
  121. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  122. package/lib/cjs/geometry3d/Range.d.ts +1 -2
  123. package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
  124. package/lib/cjs/geometry3d/Range.js +1 -2
  125. package/lib/cjs/geometry3d/Range.js.map +1 -1
  126. package/lib/cjs/geometry3d/Ray3d.d.ts +5 -5
  127. package/lib/cjs/geometry3d/Ray3d.js +5 -5
  128. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  129. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  130. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  131. package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
  132. package/lib/cjs/numerics/Polynomials.js +0 -1
  133. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  134. package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts +4 -4
  135. package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
  136. package/lib/cjs/polyface/IndexedEdgeMatcher.js +3 -3
  137. package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
  138. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  139. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  140. package/lib/cjs/polyface/Polyface.d.ts +7 -2
  141. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  142. package/lib/cjs/polyface/Polyface.js +8 -1
  143. package/lib/cjs/polyface/Polyface.js.map +1 -1
  144. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  145. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  146. package/lib/cjs/polyface/PolyfaceQuery.d.ts +36 -8
  147. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  148. package/lib/cjs/polyface/PolyfaceQuery.js +112 -31
  149. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  150. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  151. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  152. package/lib/cjs/serialization/IModelJsonSchema.d.ts +1 -1
  153. package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
  154. package/lib/cjs/serialization/IModelJsonSchema.js +4 -3
  155. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  156. package/lib/cjs/solid/Sphere.d.ts +1 -1
  157. package/lib/cjs/solid/Sphere.js +3 -3
  158. package/lib/cjs/solid/Sphere.js.map +1 -1
  159. package/lib/cjs/solid/TorusPipe.d.ts +17 -13
  160. package/lib/cjs/solid/TorusPipe.d.ts.map +1 -1
  161. package/lib/cjs/solid/TorusPipe.js +67 -38
  162. package/lib/cjs/solid/TorusPipe.js.map +1 -1
  163. package/lib/cjs/topology/Graph.d.ts +1 -1
  164. package/lib/cjs/topology/Graph.js +1 -1
  165. package/lib/cjs/topology/Graph.js.map +1 -1
  166. package/lib/cjs/topology/Merging.d.ts.map +1 -1
  167. package/lib/cjs/topology/Merging.js +9 -1
  168. package/lib/cjs/topology/Merging.js.map +1 -1
  169. package/lib/cjs/topology/Triangulation.d.ts +1 -1
  170. package/lib/cjs/topology/Triangulation.js +1 -1
  171. package/lib/cjs/topology/Triangulation.js.map +1 -1
  172. package/lib/esm/Geometry.d.ts +26 -10
  173. package/lib/esm/Geometry.d.ts.map +1 -1
  174. package/lib/esm/Geometry.js +32 -17
  175. package/lib/esm/Geometry.js.map +1 -1
  176. package/lib/esm/bspline/BSplineCurve.d.ts +11 -5
  177. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  178. package/lib/esm/bspline/BSplineCurve.js +47 -18
  179. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  180. package/lib/esm/bspline/BezierCurveBase.d.ts +10 -3
  181. package/lib/esm/bspline/BezierCurveBase.d.ts.map +1 -1
  182. package/lib/esm/bspline/BezierCurveBase.js +12 -4
  183. package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
  184. package/lib/esm/bspline/InterpolationCurve3d.d.ts.map +1 -1
  185. package/lib/esm/bspline/InterpolationCurve3d.js +4 -1
  186. package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
  187. package/lib/esm/bspline/KnotVector.d.ts.map +1 -1
  188. package/lib/esm/bspline/KnotVector.js +3 -0
  189. package/lib/esm/bspline/KnotVector.js.map +1 -1
  190. package/lib/esm/curve/Arc3d.d.ts +10 -4
  191. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  192. package/lib/esm/curve/Arc3d.js +17 -5
  193. package/lib/esm/curve/Arc3d.js.map +1 -1
  194. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +15 -7
  195. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  196. package/lib/esm/curve/CurveChainWithDistanceIndex.js +46 -29
  197. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  198. package/lib/esm/curve/CurveCollection.d.ts +13 -4
  199. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  200. package/lib/esm/curve/CurveCollection.js +23 -2
  201. package/lib/esm/curve/CurveCollection.js.map +1 -1
  202. package/lib/esm/curve/CurveCurveIntersectXY.js +1 -1
  203. package/lib/esm/curve/CurveCurveIntersectXY.js.map +1 -1
  204. package/lib/esm/curve/CurveCurveIntersectXYZ.d.ts +4 -3
  205. package/lib/esm/curve/CurveCurveIntersectXYZ.d.ts.map +1 -1
  206. package/lib/esm/curve/CurveCurveIntersectXYZ.js +8 -6
  207. package/lib/esm/curve/CurveCurveIntersectXYZ.js.map +1 -1
  208. package/lib/esm/curve/CurvePrimitive.d.ts +20 -18
  209. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  210. package/lib/esm/curve/CurvePrimitive.js +52 -333
  211. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  212. package/lib/esm/curve/LineSegment3d.d.ts +8 -2
  213. package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
  214. package/lib/esm/curve/LineSegment3d.js +9 -0
  215. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  216. package/lib/esm/curve/LineString3d.d.ts +18 -2
  217. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  218. package/lib/esm/curve/LineString3d.js +39 -23
  219. package/lib/esm/curve/LineString3d.js.map +1 -1
  220. package/lib/esm/curve/ProxyCurve.d.ts +9 -7
  221. package/lib/esm/curve/ProxyCurve.d.ts.map +1 -1
  222. package/lib/esm/curve/ProxyCurve.js +4 -0
  223. package/lib/esm/curve/ProxyCurve.js.map +1 -1
  224. package/lib/esm/curve/Query/PlanarSubdivision.d.ts +2 -1
  225. package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  226. package/lib/esm/curve/Query/PlanarSubdivision.js +5 -4
  227. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  228. package/lib/esm/curve/RegionOps.d.ts +5 -0
  229. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  230. package/lib/esm/curve/RegionOps.js +17 -3
  231. package/lib/esm/curve/RegionOps.js.map +1 -1
  232. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts +9 -6
  233. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  234. package/lib/esm/curve/RegionOpsClassificationSweeps.js +56 -48
  235. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  236. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts +55 -0
  237. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts.map +1 -0
  238. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js +139 -0
  239. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -0
  240. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts +43 -0
  241. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -0
  242. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js +142 -0
  243. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -0
  244. package/lib/esm/curve/internalContexts/CurveLengthContext.d.ts +33 -0
  245. package/lib/esm/curve/internalContexts/CurveLengthContext.d.ts.map +1 -0
  246. package/lib/esm/curve/internalContexts/CurveLengthContext.js +87 -0
  247. package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -0
  248. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts +21 -0
  249. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts.map +1 -0
  250. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js +30 -0
  251. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -0
  252. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +31 -8
  253. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
  254. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js +77 -12
  255. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  256. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts +2 -2
  257. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  258. package/lib/esm/curve/spiral/DirectSpiral3d.js +15 -8
  259. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  260. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts +12 -7
  261. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  262. package/lib/esm/curve/spiral/TransitionSpiral3d.js +12 -3
  263. package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
  264. package/lib/esm/geometry3d/Angle.d.ts +66 -42
  265. package/lib/esm/geometry3d/Angle.d.ts.map +1 -1
  266. package/lib/esm/geometry3d/Angle.js +201 -99
  267. package/lib/esm/geometry3d/Angle.js.map +1 -1
  268. package/lib/esm/geometry3d/AngleSweep.d.ts +102 -60
  269. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  270. package/lib/esm/geometry3d/AngleSweep.js +191 -106
  271. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  272. package/lib/esm/geometry3d/Matrix3d.d.ts +25 -8
  273. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  274. package/lib/esm/geometry3d/Matrix3d.js +67 -15
  275. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  276. package/lib/esm/geometry3d/Point2dArrayCarrier.d.ts +1 -0
  277. package/lib/esm/geometry3d/Point2dArrayCarrier.d.ts.map +1 -1
  278. package/lib/esm/geometry3d/Point2dArrayCarrier.js +2 -1
  279. package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
  280. package/lib/esm/geometry3d/Point2dVector2d.d.ts +86 -25
  281. package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
  282. package/lib/esm/geometry3d/Point2dVector2d.js +230 -81
  283. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  284. package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts +14 -4
  285. package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  286. package/lib/esm/geometry3d/Point3dArrayCarrier.js +15 -5
  287. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  288. package/lib/esm/geometry3d/Point3dVector3d.d.ts +121 -67
  289. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  290. package/lib/esm/geometry3d/Point3dVector3d.js +318 -137
  291. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  292. package/lib/esm/geometry3d/Range.d.ts +1 -2
  293. package/lib/esm/geometry3d/Range.d.ts.map +1 -1
  294. package/lib/esm/geometry3d/Range.js +1 -2
  295. package/lib/esm/geometry3d/Range.js.map +1 -1
  296. package/lib/esm/geometry3d/Ray3d.d.ts +5 -5
  297. package/lib/esm/geometry3d/Ray3d.js +5 -5
  298. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  299. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  300. package/lib/esm/geometry3d/Transform.js.map +1 -1
  301. package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
  302. package/lib/esm/numerics/Polynomials.js +0 -1
  303. package/lib/esm/numerics/Polynomials.js.map +1 -1
  304. package/lib/esm/polyface/IndexedEdgeMatcher.d.ts +4 -4
  305. package/lib/esm/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
  306. package/lib/esm/polyface/IndexedEdgeMatcher.js +3 -3
  307. package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
  308. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  309. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  310. package/lib/esm/polyface/Polyface.d.ts +7 -2
  311. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  312. package/lib/esm/polyface/Polyface.js +8 -1
  313. package/lib/esm/polyface/Polyface.js.map +1 -1
  314. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  315. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  316. package/lib/esm/polyface/PolyfaceQuery.d.ts +36 -8
  317. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  318. package/lib/esm/polyface/PolyfaceQuery.js +113 -32
  319. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  320. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  321. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  322. package/lib/esm/serialization/IModelJsonSchema.d.ts +1 -1
  323. package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
  324. package/lib/esm/serialization/IModelJsonSchema.js +4 -3
  325. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  326. package/lib/esm/solid/Sphere.d.ts +1 -1
  327. package/lib/esm/solid/Sphere.js +3 -3
  328. package/lib/esm/solid/Sphere.js.map +1 -1
  329. package/lib/esm/solid/TorusPipe.d.ts +17 -13
  330. package/lib/esm/solid/TorusPipe.d.ts.map +1 -1
  331. package/lib/esm/solid/TorusPipe.js +67 -38
  332. package/lib/esm/solid/TorusPipe.js.map +1 -1
  333. package/lib/esm/topology/Graph.d.ts +1 -1
  334. package/lib/esm/topology/Graph.js +1 -1
  335. package/lib/esm/topology/Graph.js.map +1 -1
  336. package/lib/esm/topology/Merging.d.ts.map +1 -1
  337. package/lib/esm/topology/Merging.js +9 -1
  338. package/lib/esm/topology/Merging.js.map +1 -1
  339. package/lib/esm/topology/Triangulation.d.ts +1 -1
  340. package/lib/esm/topology/Triangulation.js +1 -1
  341. package/lib/esm/topology/Triangulation.js.map +1 -1
  342. package/package.json +5 -5
@@ -17,11 +17,20 @@ import { Angle } from "./Angle";
17
17
  * @public
18
18
  */
19
19
  export class XY {
20
- constructor(x = 0, y = 0) { this.x = x; this.y = y; }
20
+ constructor(x = 0, y = 0) {
21
+ this.x = x;
22
+ this.y = y;
23
+ }
21
24
  /** Set both x and y. */
22
- set(x = 0, y = 0) { this.x = x; this.y = y; }
25
+ set(x = 0, y = 0) {
26
+ this.x = x;
27
+ this.y = y;
28
+ }
23
29
  /** Set both x and y to zero */
24
- setZero() { this.x = 0; this.y = 0; }
30
+ setZero() {
31
+ this.x = 0;
32
+ this.y = 0;
33
+ }
25
34
  /** Set both x and y from other. */
26
35
  setFrom(other) {
27
36
  if (other) {
@@ -34,16 +43,30 @@ export class XY {
34
43
  }
35
44
  }
36
45
  /** Freeze this instance so it is read-only */
37
- freeze() { return Object.freeze(this); }
46
+ freeze() {
47
+ return Object.freeze(this);
48
+ }
38
49
  /** Returns true if this and other have equal x,y parts within Geometry.smallMetricDistance. */
39
- isAlmostEqual(other, tol) { return Geometry.isSameCoordinate(this.x, other.x, tol) && Geometry.isSameCoordinate(this.y, other.y, tol); }
50
+ isAlmostEqual(other, tol) {
51
+ return Geometry.isSameCoordinate(this.x, other.x, tol) && Geometry.isSameCoordinate(this.y, other.y, tol);
52
+ }
40
53
  /** Returns true if this and other have equal x,y parts within Geometry.smallMetricDistance. */
41
- isAlmostEqualXY(x, y, tol) { return Geometry.isSameCoordinate(this.x, x, tol) && Geometry.isSameCoordinate(this.y, y, tol); }
54
+ isAlmostEqualXY(x, y, tol) {
55
+ return Geometry.isSameCoordinate(this.x, x, tol) && Geometry.isSameCoordinate(this.y, y, tol);
56
+ }
42
57
  /** return a json array `[x,y]` */
43
- toJSON() { return [this.x, this.y]; }
58
+ toJSON() {
59
+ return [this.x, this.y];
60
+ }
44
61
  /** return a json object `{x: 1, y:2}` */
45
- toJSONXY() { return { x: this.x, y: this.y }; }
46
- /** Set x and y from a JSON source such as `[1,2]` or `{x:1, y:2}` */
62
+ toJSONXY() {
63
+ return { x: this.x, y: this.y };
64
+ }
65
+ /**
66
+ * Set x and y from a JSON input such as `[1,2]` or `{x:1, y:2}`
67
+ * * If no JSON input is provided, 0 would be used as default values for x and y.
68
+ * @param json the JSON input
69
+ * */
47
70
  setFromJSON(json) {
48
71
  if (Array.isArray(json)) {
49
72
  this.set(json[0] || 0, json[1] || 0);
@@ -59,39 +82,76 @@ export class XY {
59
82
  distance(other) {
60
83
  const xDist = other.x - this.x;
61
84
  const yDist = other.y - this.y;
62
- return (Math.sqrt(xDist * xDist + yDist * yDist));
85
+ return Math.sqrt(xDist * xDist + yDist * yDist);
63
86
  }
64
87
  /** Return squared distance from this point to other */
65
88
  distanceSquared(other) {
66
89
  const xDist = other.x - this.x;
67
90
  const yDist = other.y - this.y;
68
- return (xDist * xDist + yDist * yDist);
91
+ return xDist * xDist + yDist * yDist;
69
92
  }
70
93
  /** Return the largest absolute distance between corresponding components */
71
94
  maxDiff(other) {
72
95
  return Math.max(Math.abs(this.x - other.x), Math.abs(this.y - other.y));
73
96
  }
97
+ /**
98
+ * Return the x,y component corresponding to 0,1.
99
+ */
100
+ at(index) {
101
+ if (index < 0.5)
102
+ return this.x;
103
+ return this.y;
104
+ }
105
+ /**
106
+ * Set value at index 0 or 1.
107
+ */
108
+ setAt(index, value) {
109
+ if (index < 0.5)
110
+ this.x = value;
111
+ else
112
+ this.y = value;
113
+ }
114
+ /** Return the index (0,1) of the x,y component with largest absolute value */
115
+ indexOfMaxAbs() {
116
+ let index = 0;
117
+ const a = Math.abs(this.x);
118
+ const b = Math.abs(this.y);
119
+ if (b > a) {
120
+ index = 1;
121
+ }
122
+ return index;
123
+ }
74
124
  /** returns true if the x,y components are both small by metric metric tolerance */
75
125
  get isAlmostZero() {
76
126
  return Geometry.isSmallMetricDistance(this.x) && Geometry.isSmallMetricDistance(this.y);
77
127
  }
78
128
  /** Return the largest absolute value of any component */
79
- maxAbs() { return Math.max(Math.abs(this.x), Math.abs(this.y)); }
129
+ maxAbs() {
130
+ return Math.max(Math.abs(this.x), Math.abs(this.y));
131
+ }
80
132
  /** Return the magnitude of the vector */
81
- magnitude() { return Math.sqrt(this.x * this.x + this.y * this.y); }
133
+ magnitude() {
134
+ return Math.sqrt(this.x * this.x + this.y * this.y);
135
+ }
82
136
  /** Return the squared magnitude of the vector. */
83
- magnitudeSquared() { return this.x * this.x + this.y * this.y; }
137
+ magnitudeSquared() {
138
+ return this.x * this.x + this.y * this.y;
139
+ }
84
140
  /** returns true if the x,y components are exactly equal. */
85
- isExactEqual(other) { return this.x === other.x && this.y === other.y; }
141
+ isExactEqual(other) {
142
+ return this.x === other.x && this.y === other.y;
143
+ }
86
144
  /** returns true if x,y match `other` within metric tolerance */
87
- isAlmostEqualMetric(other) { return this.maxDiff(other) <= Geometry.smallMetricDistance; }
145
+ isAlmostEqualMetric(other, distanceTol = Geometry.smallMetricDistance) {
146
+ return this.maxDiff(other) <= distanceTol;
147
+ }
88
148
  /** Return a (full length) vector from this point to other */
89
149
  vectorTo(other, result) {
90
150
  return Vector2d.create(other.x - this.x, other.y - this.y, result);
91
151
  }
92
152
  /** Return a unit vector from this point to other */
93
- unitVectorTo(target, result) {
94
- return this.vectorTo(target, result).normalize(result);
153
+ unitVectorTo(other, result) {
154
+ return this.vectorTo(other, result).normalize(result);
95
155
  }
96
156
  /** cross product of vectors from origin to targets */
97
157
  static crossProductToPoints(origin, targetA, targetB) {
@@ -103,9 +163,13 @@ export class XY {
103
163
  */
104
164
  export class Point2d extends XY {
105
165
  /** Constructor for Point2d */
106
- constructor(x = 0, y = 0) { super(x, y); }
166
+ constructor(x = 0, y = 0) {
167
+ super(x, y);
168
+ }
107
169
  /** return a new Point2d with x,y coordinates from this. */
108
- clone(result) { return Point2d.create(this.x, this.y, result); }
170
+ clone(result) {
171
+ return Point2d.create(this.x, this.y, result);
172
+ }
109
173
  /**
110
174
  * Return a point (newly created unless result provided) with given x,y coordinates
111
175
  * @param x x coordinate
@@ -120,8 +184,16 @@ export class Point2d extends XY {
120
184
  }
121
185
  return new Point2d(x, y);
122
186
  }
123
- /** Convert JSON `[1,2]` or `{x:1, y:2}` to a Point2d instance */
124
- static fromJSON(json) { const val = new Point2d(); val.setFromJSON(json); return val; }
187
+ /**
188
+ * Set x and y from a JSON input such as `[1,2]` or `{x:1, y:2}`
189
+ * * If no JSON input is provided, 0 would be used as default values for x and y.
190
+ * @param json the JSON input
191
+ * */
192
+ static fromJSON(json) {
193
+ const val = new Point2d();
194
+ val.setFromJSON(json);
195
+ return val;
196
+ }
125
197
  /** Create (or optionally reuse) a Point2d from another object with fields x and y */
126
198
  static createFrom(xy, result) {
127
199
  if (xy)
@@ -129,19 +201,22 @@ export class Point2d extends XY {
129
201
  return Point2d.create(0, 0, result);
130
202
  }
131
203
  /** Create a Point2d with both coordinates zero. */
132
- static createZero(result) { return Point2d.create(0, 0, result); }
133
- /** Starting at this point, move along vector by tangentFraction of the vector length, and to the left by leftFraction of
134
- * the perpendicular vector length.
204
+ static createZero(result) {
205
+ return Point2d.create(0, 0, result);
206
+ }
207
+ /** Starting at this point, move along vector by tangentFraction of the vector length, and then
208
+ * to the left by leftFraction of the perpendicular vector length.
135
209
  * @param tangentFraction distance to move along the vector, as a fraction of vector
136
210
  * @param leftFraction distance to move perpendicular to the vector, as a fraction of the rotated vector
211
+ * @param vector the other vector
137
212
  */
138
213
  addForwardLeft(tangentFraction, leftFraction, vector) {
139
214
  const dx = vector.x;
140
215
  const dy = vector.y;
141
216
  return Point2d.create(this.x + tangentFraction * dx - leftFraction * dy, this.y + tangentFraction * dy + leftFraction * dx);
142
217
  }
143
- /** Interpolate at tangentFraction between this instance and point. Move by leftFraction along the xy perpendicular
144
- * of the vector between the points.
218
+ /** Interpolate at tangentFraction between this instance and point, and then Move by leftFraction
219
+ * along the xy perpendicular of the vector between the points.
145
220
  */
146
221
  forwardLeftInterpolate(tangentFraction, leftFraction, point) {
147
222
  const dx = point.x - this.x;
@@ -189,10 +264,13 @@ export class Point2d extends XY {
189
264
  * @param targetB target of second vector
190
265
  */
191
266
  dotVectorsToTargets(targetA, targetB) {
192
- return (targetA.x - this.x) * (targetB.x - this.x) +
193
- (targetA.y - this.y) * (targetB.y - this.y);
267
+ return (targetA.x - this.x) * (targetB.x - this.x) + (targetA.y - this.y) * (targetB.y - this.y);
194
268
  }
195
- /** Returns the (scalar) cross product of two points/vectors, computed from origin to target1 and target2 */
269
+ /**
270
+ * Returns the (scalar) cross product of vector from this to targetA and vector from this to targetB
271
+ * @param target1 target of first vector
272
+ * @param target2 target of second vector
273
+ */
196
274
  crossProductToPoints(target1, target2) {
197
275
  const x1 = target1.x - this.x;
198
276
  const y1 = target1.y - this.y;
@@ -200,25 +278,31 @@ export class Point2d extends XY {
200
278
  const y2 = target2.y - this.y;
201
279
  return x1 * y2 - y1 * x2;
202
280
  }
203
- /** Return the fractional coordinate of the projection of this instance x,y onto the line from startPoint to endPoint.
281
+ /** Return the fractional coordinate of the projection of this instance x,y onto the
282
+ * line from startPoint to endPoint.
204
283
  * @param startPoint start point of line
205
284
  * @param endPoint end point of line
206
285
  * @param defaultFraction fraction to return if startPoint and endPoint are equal.
207
286
  */
208
- fractionOfProjectionToLine(startPoint, endPoint, defaultFraction) {
287
+ fractionOfProjectionToLine(startPoint, endPoint, defaultFraction = 0) {
209
288
  const denominator = startPoint.distanceSquared(endPoint);
210
289
  if (denominator < Geometry.smallMetricDistanceSquared)
211
- return defaultFraction ? defaultFraction : 0;
212
- return startPoint.dotVectorsToTargets(endPoint, this) / denominator;
290
+ return defaultFraction;
291
+ const numerator = startPoint.dotVectorsToTargets(endPoint, this);
292
+ return numerator / denominator;
213
293
  }
214
294
  }
215
295
  /** 2D vector with `x`,`y` as properties
216
296
  * @public
217
297
  */
218
298
  export class Vector2d extends XY {
219
- constructor(x = 0, y = 0) { super(x, y); }
299
+ constructor(x = 0, y = 0) {
300
+ super(x, y);
301
+ }
220
302
  /** Return a new Vector2d with the same x,y */
221
- clone(result) { return Vector2d.create(this.x, this.y, result); }
303
+ clone(result) {
304
+ return Vector2d.create(this.x, this.y, result);
305
+ }
222
306
  /** Return a new Vector2d with given x and y */
223
307
  static create(x = 0, y = 0, result) {
224
308
  if (result) {
@@ -228,12 +312,24 @@ export class Vector2d extends XY {
228
312
  }
229
313
  return new Vector2d(x, y);
230
314
  }
231
- /** Return a (new) Vector2d with components 1,0 */
232
- static unitX(scale = 1) { return new Vector2d(scale, 0); }
233
- /** Return a (new) Vector2d with components 0,1 */
234
- static unitY(scale = 1) { return new Vector2d(0, scale); }
315
+ /**
316
+ * Return a (new) Vector2d with components scale,0
317
+ * If scale is not given default value 1 is used.
318
+ */
319
+ static unitX(scale = 1) {
320
+ return new Vector2d(scale, 0);
321
+ }
322
+ /**
323
+ * Return a (new) Vector2d with components 0,scale
324
+ * If scale is not given default value 1 is used.
325
+ */
326
+ static unitY(scale = 1) {
327
+ return new Vector2d(0, scale);
328
+ }
235
329
  /** Return a Vector2d with components 0,0 */
236
- static createZero(result) { return Vector2d.create(0, 0, result); }
330
+ static createZero(result) {
331
+ return Vector2d.create(0, 0, result);
332
+ }
237
333
  /** copy contents from another Point3d, Point2d, Vector2d, or Vector3d, or leading entries of Float64Array */
238
334
  static createFrom(data, result) {
239
335
  if (data instanceof Float64Array) {
@@ -245,8 +341,16 @@ export class Vector2d extends XY {
245
341
  }
246
342
  return Vector2d.create(data.x, data.y, result);
247
343
  }
248
- /** Return a new Vector2d from json structured as `[1,2]` or `{x:1,y:2}` */
249
- static fromJSON(json) { const val = new Vector2d(); val.setFromJSON(json); return val; }
344
+ /**
345
+ * Set x and y from a JSON input such as `[1,2]` or `{x:1, y:2}`
346
+ * * If no JSON input is provided, 0 would be used as default values for x and y.
347
+ * @param json the JSON input
348
+ * */
349
+ static fromJSON(json) {
350
+ const val = new Vector2d();
351
+ val.setFromJSON(json);
352
+ return val;
353
+ }
250
354
  /** Return a new Vector2d from polar coordinates for radius and Angle from x axis */
251
355
  static createPolar(r, theta) {
252
356
  return Vector2d.create(r * theta.cos(), r * theta.sin());
@@ -257,6 +361,7 @@ export class Vector2d extends XY {
257
361
  }
258
362
  /**
259
363
  * Return a vector that bisects the angle between two normals and extends to the intersection of two offset lines
364
+ * * returns `undefined` if `unitPerpA = -unitPerpB` (i.e., are opposite)
260
365
  * @param unitPerpA unit perpendicular to incoming direction
261
366
  * @param unitPerpB unit perpendicular to outgoing direction
262
367
  * @param offset offset distance
@@ -265,12 +370,13 @@ export class Vector2d extends XY {
265
370
  let bisector = unitPerpA.plus(unitPerpB);
266
371
  bisector = bisector.normalize();
267
372
  if (bisector) {
268
- const c = offset * bisector.dotProduct(unitPerpA);
373
+ const c = bisector.dotProduct(unitPerpA);
374
+ bisector.scale(offset, bisector);
269
375
  return bisector.safeDivideOrNull(c);
270
376
  }
271
377
  return undefined;
272
378
  }
273
- /** Return a (new or optionally reused) vector which is `this` divided by denominator
379
+ /** Return a (new or optionally reused) vector which is `this` divided by `denominator`
274
380
  * * return undefined if denominator is zero.
275
381
  */
276
382
  safeDivideOrNull(denominator, result) {
@@ -285,12 +391,22 @@ export class Vector2d extends XY {
285
391
  result = result ? result : new Vector2d();
286
392
  return this.safeDivideOrNull(mag, result);
287
393
  }
288
- /** return the fractional projection of spaceVector onto this */
394
+ /**
395
+ * Return fractional projection of target vector onto this
396
+ * * It's returning the signed projection magnitude divided by the target magnitude. In other words,
397
+ * it's returning the length of the projection as a fraction of the target magnitude.
398
+ * @param target the target vector
399
+ * @param defaultFraction the returned value in case magnitude square of target vector is very small
400
+ * */
289
401
  fractionOfProjectionToVector(target, defaultFraction) {
290
- const numerator = this.dotProduct(target);
402
+ /*
403
+ * projection length is (this.target)/||target||
404
+ * but here we return (this.target)/||target||^2
405
+ */
291
406
  const denominator = target.magnitudeSquared();
292
407
  if (denominator < Geometry.smallMetricDistanceSquared)
293
408
  return defaultFraction ? defaultFraction : 0;
409
+ const numerator = this.dotProduct(target);
294
410
  return numerator / denominator;
295
411
  }
296
412
  /** Return a new vector with components negated from this instance. */
@@ -303,7 +419,7 @@ export class Vector2d extends XY {
303
419
  /** Return a vector same length as this but rotated 90 degrees counter clockwise */
304
420
  rotate90CCWXY(result) {
305
421
  result = result ? result : new Vector2d();
306
- // save x,y to allow aliasing ..
422
+ // save x,y to allow aliasing ("this" can be passed to the function as "result")
307
423
  const xx = this.x;
308
424
  const yy = this.y;
309
425
  result.x = -yy;
@@ -313,7 +429,7 @@ export class Vector2d extends XY {
313
429
  /** Return a vector same length as this but rotated 90 degrees clockwise */
314
430
  rotate90CWXY(result) {
315
431
  result = result ? result : new Vector2d();
316
- // save x,y to allow aliasing ..
432
+ // save x,y to allow aliasing ("this" can be passed to the function as "result")
317
433
  const xx = this.x;
318
434
  const yy = this.y;
319
435
  result.x = yy;
@@ -325,6 +441,7 @@ export class Vector2d extends XY {
325
441
  result = result ? result : new Vector2d();
326
442
  const xx = this.x;
327
443
  const yy = this.y;
444
+ // save x,y to allow aliasing ("this" can be passed to the function as "result")
328
445
  result.x = -yy;
329
446
  result.y = xx;
330
447
  const d2 = xx * xx + yy * yy;
@@ -339,6 +456,7 @@ export class Vector2d extends XY {
339
456
  rotateXY(angle, result) {
340
457
  const s = angle.sin();
341
458
  const c = angle.cos();
459
+ // save x,y to allow aliasing ("this" can be passed to the function as "result")
342
460
  const xx = this.x;
343
461
  const yy = this.y;
344
462
  result = result ? result : new Vector2d();
@@ -346,18 +464,26 @@ export class Vector2d extends XY {
346
464
  result.y = xx * s + yy * c;
347
465
  return result;
348
466
  }
349
- /** return the interpolation {this + fraction * (right - this)} */
350
- interpolate(fraction, right, result) {
467
+ /** Return a vector computed at fractional position between this vector and vectorB
468
+ * @param fraction fractional position. 0 is at `this`. 1 is at `vectorB`.
469
+ * True fractions are "between", negatives are "before this", beyond 1 is "beyond vectorB".
470
+ * @param vectorB second vector
471
+ * @param result optional preallocated result.
472
+ */
473
+ interpolate(fraction, vectorB, result) {
351
474
  result = result ? result : new Vector2d();
352
- /* For best last-bit behavior, if fraction is below 0.5, use this as base point. If above 0.5, use right as base point. */
475
+ /*
476
+ * For best last-bit behavior, if fraction is below 0.5, use this as base point.
477
+ * If above 0.5, use vectorB as base point.
478
+ */
353
479
  if (fraction <= 0.5) {
354
- result.x = this.x + fraction * (right.x - this.x);
355
- result.y = this.y + fraction * (right.y - this.y);
480
+ result.x = this.x + fraction * (vectorB.x - this.x);
481
+ result.y = this.y + fraction * (vectorB.y - this.y);
356
482
  }
357
483
  else {
358
484
  const t = fraction - 1.0;
359
- result.x = right.x + t * (right.x - this.x);
360
- result.y = right.y + t * (right.y - this.y);
485
+ result.x = vectorB.x + t * (vectorB.x - this.x);
486
+ result.y = vectorB.y + t * (vectorB.y - this.y);
361
487
  }
362
488
  return result;
363
489
  }
@@ -411,36 +537,47 @@ export class Vector2d extends XY {
411
537
  return this.scale(length / mag, result);
412
538
  }
413
539
  /** return the dot product of this with vectorB */
414
- dotProduct(vectorB) { return this.x * vectorB.x + this.y * vectorB.y; }
540
+ dotProduct(vectorB) {
541
+ return this.x * vectorB.x + this.y * vectorB.y;
542
+ }
415
543
  /** dot product with vector from pointA to pointB */
416
544
  dotProductStartEnd(pointA, pointB) {
417
- return this.x * (pointB.x - pointA.x)
418
- + this.y * (pointB.y - pointA.y);
545
+ return this.x * (pointB.x - pointA.x) + this.y * (pointB.y - pointA.y);
419
546
  }
420
547
  /** vector cross product {this CROSS vectorB} */
421
- crossProduct(vectorB) { return this.x * vectorB.y - this.y * vectorB.x; }
422
- /** return the (signed) angle from this to vectorB. This is positive if the shortest turn is counterclockwise, negative if clockwise. */
548
+ crossProduct(vectorB) {
549
+ return this.x * vectorB.y - this.y * vectorB.x;
550
+ }
551
+ /**
552
+ * return the radians (as a simple number, not strongly typed Angle) signed angle from this to vectorB.
553
+ * This is positive if the shortest turn is counterclockwise, negative if clockwise.
554
+ */
555
+ radiansTo(vectorB) {
556
+ return Math.atan2(this.crossProduct(vectorB), this.dotProduct(vectorB));
557
+ }
558
+ /**
559
+ * return the (strongly typed) signed angle from this to vectorB.
560
+ * This is positive if the shortest turn is counterclockwise, negative if clockwise.
561
+ */
423
562
  angleTo(vectorB) {
424
- return Angle.createAtan2(this.crossProduct(vectorB), this.dotProduct(vectorB));
425
- }
426
- /* smallerUnorientedAngleTo(vectorB: Vector2d): Angle { }
427
- signedAngleTo(vectorB: Vector2d, upVector: Vector2d): Angle { }
428
- planarAngleTo(vectorB: Vector2d, planeNormal: Vector2d): Angle { }
429
- // sectors
430
- isInSmallerSector(vectorA: Vector2d, vectorB: Vector2d): boolean { }
431
- isInCCWSector(vectorA: Vector2d, vectorB: Vector2d, upVector: Vector2d): boolean { }
432
- */
563
+ return Angle.createRadians(this.radiansTo(vectorB));
564
+ }
433
565
  /**
434
- * Test if `this` and `other` area parallel, with angle tolerance `Geometry.smallAngleRadiansSquared`.
566
+ * Test if this vector is parallel to other.
567
+ * * The input tolerances in `options`, if given, are considered to be squared for efficiency's sake,
568
+ * so if you have a distance or angle tolerance t, you should pass in t * t.
435
569
  * @param other second vector for comparison.
436
- * @param oppositeIsParallel if true, treat vectors 180 opposite as parallel. If false, treat those as non-parallel.
570
+ * @param oppositeIsParallel whether to consider diametrically opposed vectors as parallel.
571
+ * @param options optional radian and distance tolerances.
437
572
  */
438
- isParallelTo(other, oppositeIsParallel = false) {
573
+ isParallelTo(other, oppositeIsParallel = false, returnValueIfAnInputIsZeroLength = false, options) {
574
+ var _a, _b;
575
+ const radianSquaredTol = (_a = options === null || options === void 0 ? void 0 : options.radianSquaredTol) !== null && _a !== void 0 ? _a : Geometry.smallAngleRadiansSquared;
576
+ const distanceSquaredTol = (_b = options === null || options === void 0 ? void 0 : options.distanceSquaredTol) !== null && _b !== void 0 ? _b : Geometry.smallMetricDistanceSquared;
439
577
  const a2 = this.magnitudeSquared();
440
578
  const b2 = other.magnitudeSquared();
441
- // we know both are 0 or positive -- no need for
442
- if (a2 < Geometry.smallMetricDistanceSquared || b2 < Geometry.smallMetricDistanceSquared)
443
- return false;
579
+ if (a2 < distanceSquaredTol || b2 < distanceSquaredTol)
580
+ return returnValueIfAnInputIsZeroLength;
444
581
  const dot = this.dotProduct(other);
445
582
  if (dot < 0.0 && !oppositeIsParallel)
446
583
  return false;
@@ -448,14 +585,26 @@ export class Vector2d extends XY {
448
585
  /* a2,b2,cross2 are squared lengths of respective vectors */
449
586
  /* cross2 = sin^2(theta) * a2 * b2 */
450
587
  /* For small theta, sin^2(theta)~~theta^2 */
451
- return cross * cross <= Geometry.smallAngleRadiansSquared * a2 * b2;
588
+ return cross * cross <= radianSquaredTol * a2 * b2;
452
589
  }
453
590
  /**
454
- * Returns `true` if `this` vector is perpendicular to `other`.
455
- * @param other second vector.
591
+ * Test if this vector is perpendicular to other.
592
+ * * The input tolerances in `options`, if given, are considered to be squared for efficiency's sake,
593
+ * so if you have a distance or angle tolerance t, you should pass in t * t.
594
+ * @param other second vector in comparison.
595
+ * @param returnValueIfAnInputIsZeroLength if either vector is near zero length, return this value.
596
+ * @param options optional radian and distance tolerances.
456
597
  */
457
- isPerpendicularTo(other) {
458
- return Angle.isPerpendicularDotSet(this.magnitudeSquared(), other.magnitudeSquared(), this.dotProduct(other));
598
+ isPerpendicularTo(other, returnValueIfAnInputIsZeroLength = false, options) {
599
+ var _a, _b;
600
+ const radianSquaredTol = (_a = options === null || options === void 0 ? void 0 : options.radianSquaredTol) !== null && _a !== void 0 ? _a : Geometry.smallAngleRadiansSquared;
601
+ const distanceSquaredTol = (_b = options === null || options === void 0 ? void 0 : options.distanceSquaredTol) !== null && _b !== void 0 ? _b : Geometry.smallMetricDistanceSquared;
602
+ const aa = this.magnitudeSquared();
603
+ const bb = other.magnitudeSquared();
604
+ if (aa < distanceSquaredTol || bb < distanceSquaredTol)
605
+ return returnValueIfAnInputIsZeroLength;
606
+ const ab = this.dotProduct(other);
607
+ return ab * ab <= radianSquaredTol * aa * bb;
459
608
  }
460
609
  }
461
610
  //# sourceMappingURL=Point2dVector2d.js.map