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

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