@itwin/core-geometry 3.5.0-dev.7 → 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
@@ -5,6 +5,7 @@
5
5
  /** @packageDocumentation
6
6
  * @module CartesianGeometry
7
7
  */
8
+ // cspell:word CWXY
8
9
  import { Geometry } from "../Geometry";
9
10
  import { Angle } from "./Angle";
10
11
  import { XYAndZ } from "./XYZProps";
@@ -17,24 +18,42 @@ import { XYAndZ } from "./XYZProps";
17
18
  * @public
18
19
  */
19
20
  export class XYZ {
20
- constructor(x = 0, y = 0, z = 0) { this.x = x; this.y = y; this.z = z; }
21
+ constructor(x = 0, y = 0, z = 0) {
22
+ this.x = x;
23
+ this.y = y;
24
+ this.z = z;
25
+ }
21
26
  /**
22
27
  * Set the x,y,z parts.
23
28
  * @param x (optional) x part
24
29
  * @param y (optional) y part
25
30
  * @param z (optional) z part
26
31
  */
27
- set(x = 0, y = 0, z = 0) { this.x = x; this.y = y; this.z = z; }
32
+ set(x = 0, y = 0, z = 0) {
33
+ this.x = x;
34
+ this.y = y;
35
+ this.z = z;
36
+ }
28
37
  /** Set the x,y,z parts to zero. */
29
- setZero() { this.x = 0; this.y = 0; this.z = 0; }
38
+ setZero() {
39
+ this.x = 0;
40
+ this.y = 0;
41
+ this.z = 0;
42
+ }
30
43
  /** Type guard for XAndY.
31
44
  * @note this will return true for an XYAndZ. If you wish to distinguish between the two, call isXYAndZ first.
32
45
  */
33
- static isXAndY(arg) { return arg.x !== undefined && arg.y !== undefined; }
46
+ static isXAndY(arg) {
47
+ return arg.x !== undefined && arg.y !== undefined;
48
+ }
34
49
  /** Type guard to determine whether an object has a member called "z" */
35
- static hasZ(arg) { return arg.z !== undefined; }
50
+ static hasZ(arg) {
51
+ return arg.z !== undefined;
52
+ }
36
53
  /** Type guard for XYAndZ. */
37
- static isXYAndZ(arg) { return this.isXAndY(arg) && this.hasZ(arg); }
54
+ static isXYAndZ(arg) {
55
+ return this.isXAndY(arg) && this.hasZ(arg);
56
+ }
38
57
  /** Test if arg is any of:
39
58
  * * XAndY
40
59
  * * XYAndZ
@@ -117,6 +136,7 @@ export class XYZ {
117
136
  /**
118
137
  * Set the x,y,z parts from a Vector3d
119
138
  * This is the same effect as `setFrom(other)` with no pretesting of variant input type
139
+ * * Set to zeros if `other` is undefined.
120
140
  */
121
141
  setFromVector3d(other) {
122
142
  if (other) {
@@ -147,13 +167,21 @@ export class XYZ {
147
167
  && Geometry.isSameCoordinate(this.y, other.y, tol);
148
168
  }
149
169
  /** Return a JSON object as array `[x,y,z]` */
150
- toJSON() { return this.toArray(); }
170
+ toJSON() {
171
+ return this.toArray();
172
+ }
151
173
  /** Return as an array `[x,y,z]` */
152
- toArray() { return [this.x, this.y, this.z]; }
174
+ toArray() {
175
+ return [this.x, this.y, this.z];
176
+ }
153
177
  /** Return a JSON object as key value pairs `{x: value, y: value, z: value}` */
154
- toJSONXYZ() { return { x: this.x, y: this.y, z: this.z }; }
178
+ toJSONXYZ() {
179
+ return { x: this.x, y: this.y, z: this.z };
180
+ }
155
181
  /** Pack the x,y,z values in a Float64Array. */
156
- toFloat64Array() { return Float64Array.of(this.x, this.y, this.z); }
182
+ toFloat64Array() {
183
+ return Float64Array.of(this.x, this.y, this.z);
184
+ }
157
185
  /**
158
186
  * Set the x,y,z properties from one of several json forms:
159
187
  *
@@ -212,7 +240,7 @@ export class XYZ {
212
240
  return this.y;
213
241
  }
214
242
  /**
215
- * Return the x,y, z component corresponding to 0,1,2.
243
+ * Set value at index 0 or 1 or 2.
216
244
  */
217
245
  setAt(index, value) {
218
246
  if (index < 0.5)
@@ -239,28 +267,54 @@ export class XYZ {
239
267
  }
240
268
  /** Return true if the x,y,z components are all nearly zero to tolerance Geometry.smallMetricDistance */
241
269
  get isAlmostZero() {
242
- return Geometry.isSmallMetricDistance(this.x) && Geometry.isSmallMetricDistance(this.y) && Geometry.isSmallMetricDistance(this.z);
270
+ return Geometry.isSmallMetricDistance(this.x) &&
271
+ Geometry.isSmallMetricDistance(this.y) &&
272
+ Geometry.isSmallMetricDistance(this.z);
243
273
  }
244
274
  /** Return true if the x,y,z components are all exactly zero */
245
- get isZero() { return this.x === 0.0 && this.y === 0.0 && this.z === 0.0; }
275
+ get isZero() {
276
+ return this.x === 0.0 && this.y === 0.0 && this.z === 0.0;
277
+ }
246
278
  /** Return the largest absolute value of any component */
247
- maxAbs() { return Math.max(Math.abs(this.x), Math.abs(this.y), Math.abs(this.z)); }
279
+ maxAbs() {
280
+ return Math.max(Math.abs(this.x), Math.abs(this.y), Math.abs(this.z));
281
+ }
248
282
  /** Return the sqrt of the sum of squared x,y,z parts */
249
- magnitude() { return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); }
283
+ magnitude() {
284
+ return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
285
+ }
250
286
  /** Return the sum of squared x,y,z parts */
251
- magnitudeSquared() { return this.x * this.x + this.y * this.y + this.z * this.z; }
287
+ magnitudeSquared() {
288
+ return this.x * this.x + this.y * this.y + this.z * this.z;
289
+ }
252
290
  /** Return sqrt of the sum of squared x,y parts */
253
- magnitudeXY() { return Math.sqrt(this.x * this.x + this.y * this.y); }
291
+ magnitudeXY() {
292
+ return Math.sqrt(this.x * this.x + this.y * this.y);
293
+ }
254
294
  /** Return the sum of squared x,y parts */
255
- magnitudeSquaredXY() { return this.x * this.x + this.y * this.y; }
295
+ magnitudeSquaredXY() {
296
+ return this.x * this.x + this.y * this.y;
297
+ }
256
298
  /** exact equality test. */
257
- isExactEqual(other) { return this.x === other.x && this.y === other.y && this.z === other.z; }
299
+ isExactEqual(other) {
300
+ return this.x === other.x && this.y === other.y && this.z === other.z;
301
+ }
258
302
  /** equality test with Geometry.smallMetricDistance tolerance */
259
- isAlmostEqualMetric(other) { return this.maxDiff(other) <= Geometry.smallMetricDistance; }
303
+ isAlmostEqualMetric(other) {
304
+ return this.maxDiff(other) <= Geometry.smallMetricDistance;
305
+ }
260
306
  /** add x,y,z from other in place. */
261
- addInPlace(other) { this.x += other.x; this.y += other.y; this.z += other.z; }
307
+ addInPlace(other) {
308
+ this.x += other.x;
309
+ this.y += other.y;
310
+ this.z += other.z;
311
+ }
262
312
  /** add x,y,z from other in place. */
263
- subtractInPlace(other) { this.x -= other.x; this.y -= other.y; this.z -= other.z; }
313
+ subtractInPlace(other) {
314
+ this.x -= other.x;
315
+ this.y -= other.y;
316
+ this.z -= other.z;
317
+ }
264
318
  /** add (in place) the scaled x,y,z of other */
265
319
  addScaledInPlace(other, scale) {
266
320
  this.x += scale * other.x;
@@ -268,11 +322,21 @@ export class XYZ {
268
322
  this.z += scale * other.z;
269
323
  }
270
324
  /** Multiply the x, y, z parts by scale. */
271
- scaleInPlace(scale) { this.x *= scale; this.y *= scale; this.z *= scale; }
325
+ scaleInPlace(scale) {
326
+ this.x *= scale;
327
+ this.y *= scale;
328
+ this.z *= scale;
329
+ }
272
330
  /** add to x, y, z parts */
273
- addXYZInPlace(dx = 0.0, dy = 0.0, dz = 0.0) { this.x += dx; this.y += dy; this.z += dz; }
331
+ addXYZInPlace(dx = 0.0, dy = 0.0, dz = 0.0) {
332
+ this.x += dx;
333
+ this.y += dy;
334
+ this.z += dz;
335
+ }
274
336
  /** Clone strongly typed as Point3d */
275
- cloneAsPoint3d() { return Point3d.create(this.x, this.y, this.z); }
337
+ cloneAsPoint3d() {
338
+ return Point3d.create(this.x, this.y, this.z);
339
+ }
276
340
  /** Return a (full length) vector from this point to other */
277
341
  vectorTo(other, result) {
278
342
  return Vector3d.create(other.x - this.x, other.y - this.y, other.z - this.z, result);
@@ -285,9 +349,13 @@ export class XYZ {
285
349
  * @param other target of created vector.
286
350
  * @param result optional result vector.
287
351
  */
288
- unitVectorTo(target, result) { return this.vectorTo(target, result).normalize(result); }
352
+ unitVectorTo(target, result) {
353
+ return this.vectorTo(target, result).normalize(result);
354
+ }
289
355
  /** Freeze this XYZ */
290
- freeze() { return Object.freeze(this); }
356
+ freeze() {
357
+ return Object.freeze(this);
358
+ }
291
359
  /** access x part of XYZProps (which may be .x or [0]) */
292
360
  static x(xyz, defaultValue = 0) {
293
361
  if (xyz === undefined)
@@ -324,7 +392,9 @@ export class XYZ {
324
392
  */
325
393
  export class Point3d extends XYZ {
326
394
  /** Constructor for Point3d */
327
- constructor(x = 0, y = 0, z = 0) { super(x, y, z); }
395
+ constructor(x = 0, y = 0, z = 0) {
396
+ super(x, y, z);
397
+ }
328
398
  /**
329
399
  * Convert json to Point3d. Accepted forms are:
330
400
  * * `[1,2,3]` --- array of numbers
@@ -332,9 +402,15 @@ export class Point3d extends XYZ {
332
402
  * * object with x,y, and (optional) z as numeric properties {x: xValue, y: yValue, z: zValue}
333
403
  * @param json json value.
334
404
  */
335
- static fromJSON(json) { const val = new Point3d(); val.setFromJSON(json); return val; }
405
+ static fromJSON(json) {
406
+ const val = new Point3d();
407
+ val.setFromJSON(json);
408
+ return val;
409
+ }
336
410
  /** Return a new Point3d with the same coordinates */
337
- clone(result) { return Point3d.create(this.x, this.y, this.z, result); }
411
+ clone(result) {
412
+ return Point3d.create(this.x, this.y, this.z, result);
413
+ }
338
414
  /** Create a new Point3d with given coordinates
339
415
  * @param x x part
340
416
  * @param y y part
@@ -380,7 +456,7 @@ export class Point3d extends XYZ {
380
456
  /**
381
457
  * Copy and unweight xyzw.
382
458
  * @param xyzData flat array of x,y,z,w,x,y,z,w for multiple points
383
- * @param pointIndex index of point to extract. This index is multiplied by 4 to obtain starting index in the array.
459
+ * @param pointIndex index of point to extract. This index is multiplied by 4 to obtain starting index in the array.
384
460
  * @param result optional result point.
385
461
  */
386
462
  static createFromPackedXYZW(xyzData, pointIndex, result) {
@@ -405,7 +481,9 @@ export class Point3d extends XYZ {
405
481
  return result;
406
482
  }
407
483
  /** Create a new point with 000 xyz */
408
- static createZero(result) { return Point3d.create(0, 0, 0, result); }
484
+ static createZero(result) {
485
+ return Point3d.create(0, 0, 0, result);
486
+ }
409
487
  /** Return the cross product of the vectors from this to pointA and pointB
410
488
  *
411
489
  * * the result is a vector
@@ -423,7 +501,7 @@ export class Point3d extends XYZ {
423
501
  /** Return the triple product of the vectors from this to pointA, pointB, pointC
424
502
  *
425
503
  * * This is a scalar (number)
426
- * * This is 6 times the (signed) volume of the tetrahedron on the 4 points.
504
+ * * This is 6 times the (signed) volume of the tetrahedron on the 4 points.
427
505
  */
428
506
  tripleProductToPoints(pointA, pointB, pointC) {
429
507
  return Geometry.tripleProduct(pointA.x - this.x, pointA.y - this.y, pointA.z - this.z, pointB.x - this.x, pointB.y - this.y, pointB.z - this.z, pointC.x - this.x, pointC.y - this.y, pointC.z - this.z);
@@ -437,7 +515,10 @@ export class Point3d extends XYZ {
437
515
  crossProductToPointsXY(pointA, pointB) {
438
516
  return Geometry.crossProductXYXY(pointA.x - this.x, pointA.y - this.y, pointB.x - this.x, pointB.y - this.y);
439
517
  }
440
- /** Return a point interpolated between this point and the right param. */
518
+ /**
519
+ * Return a point interpolated between `this` point and the `other` point.
520
+ * * fraction specifies where the interpolated point is located on the line passing `this` and `other`.
521
+ * */
441
522
  interpolate(fraction, other, result) {
442
523
  if (fraction <= 0.5)
443
524
  return Point3d.create(this.x + fraction * (other.x - this.x), this.y + fraction * (other.y - this.y), this.z + fraction * (other.z - this.z), result);
@@ -520,9 +601,7 @@ export class Point3d extends XYZ {
520
601
  (targetA.y - this.y) * (targetB.y - this.y) +
521
602
  (targetA.z - this.z) * (targetB.z - this.z);
522
603
  }
523
- /** Return the fractional projection of this onto a line between points.
524
- *
525
- */
604
+ /** Return the fractional projection of this onto a line between points. */
526
605
  fractionOfProjectionToLine(startPoint, endPoint, defaultFraction = 0) {
527
606
  const denominator = startPoint.distanceSquared(endPoint);
528
607
  if (denominator < Geometry.smallMetricDistanceSquared)
@@ -534,7 +613,9 @@ export class Point3d extends XYZ {
534
613
  * @public
535
614
  */
536
615
  export class Vector3d extends XYZ {
537
- constructor(x = 0, y = 0, z = 0) { super(x, y, z); }
616
+ constructor(x = 0, y = 0, z = 0) {
617
+ super(x, y, z);
618
+ }
538
619
  /**
539
620
  * Return an array of vectors constructed from groups of 3 entries in a Float64Array.
540
621
  * Any incomplete group at the tail of the array is ignored.
@@ -549,7 +630,9 @@ export class Vector3d extends XYZ {
549
630
  * Copy xyz from this instance to a new (or optionally reused) Vector3d
550
631
  * @param result optional instance to reuse.
551
632
  */
552
- clone(result) { return Vector3d.create(this.x, this.y, this.z, result); }
633
+ clone(result) {
634
+ return Vector3d.create(this.x, this.y, this.z, result);
635
+ }
553
636
  /**
554
637
  * return a Vector3d (new or reused from optional result)
555
638
  * @param x x component
@@ -638,7 +721,11 @@ export class Vector3d extends XYZ {
638
721
  * * object with x,y, and (optional) z as numeric properties {x: xValue, y: yValue, z: zValue}
639
722
  * @param json json value.
640
723
  */
641
- static fromJSON(json) { const val = new Vector3d(); val.setFromJSON(json); return val; }
724
+ static fromJSON(json) {
725
+ const val = new Vector3d();
726
+ val.setFromJSON(json);
727
+ return val;
728
+ }
642
729
  /** Copy contents from another Point3d, Point2d, Vector2d, or Vector3d */
643
730
  static createFrom(data, result) {
644
731
  if (data instanceof Float64Array) {
@@ -714,7 +801,7 @@ export class Vector3d extends XYZ {
714
801
  return undefined;
715
802
  }
716
803
  /**
717
- * Set (replace) xzz components so they are a vector from point0 to point1
804
+ * Set (replace) xyz components so they are a vector from point0 to point1
718
805
  * @param point0 start point of computed vector
719
806
  * @param point1 end point of computed vector.
720
807
  */
@@ -724,13 +811,21 @@ export class Vector3d extends XYZ {
724
811
  this.z = point1.z - point0.z;
725
812
  }
726
813
  /** Return a vector with 000 xyz parts. */
727
- static createZero(result) { return Vector3d.create(0, 0, 0, result); }
814
+ static createZero(result) {
815
+ return Vector3d.create(0, 0, 0, result);
816
+ }
728
817
  /** Return a unit X vector optionally multiplied by a scale */
729
- static unitX(scale = 1) { return new Vector3d(scale, 0, 0); }
730
- /** Return a unit Y vector */
731
- static unitY(scale = 1) { return new Vector3d(0, scale, 0); }
732
- /** Return a unit Z vector */
733
- static unitZ(scale = 1) { return new Vector3d(0, 0, scale); }
818
+ static unitX(scale = 1) {
819
+ return new Vector3d(scale, 0, 0);
820
+ }
821
+ /** Return a unit Y vector optionally multiplied by a scale */
822
+ static unitY(scale = 1) {
823
+ return new Vector3d(0, scale, 0);
824
+ }
825
+ /** Return a unit Z vector optionally multiplied by a scale */
826
+ static unitZ(scale = 1) {
827
+ return new Vector3d(0, 0, scale);
828
+ }
734
829
  /** Divide by denominator, but return undefined if denominator is zero. */
735
830
  safeDivideOrNull(denominator, result) {
736
831
  if (denominator !== 0.0) {
@@ -739,8 +834,8 @@ export class Vector3d extends XYZ {
739
834
  return undefined;
740
835
  }
741
836
  /**
742
- * Return a pair object containing (a) property `v` which is a unit vector in the direction
743
- * of the input and (b) property mag which is the magnitude (length) of the input (instance) prior to normalization.
837
+ * Return a pair object containing (a) property `v` which is a unit vector in the direction of the input
838
+ * and (b) property mag which is the magnitude (length) of the input (instance) prior to normalization.
744
839
  * If the instance (input) is a near zero length the `v` property of the output is undefined.
745
840
  * @param result optional result.
746
841
  */
@@ -753,7 +848,9 @@ export class Vector3d extends XYZ {
753
848
  * Return a unit vector parallel with this. Return undefined if this.magnitude is near zero.
754
849
  * @param result optional result.
755
850
  */
756
- normalize(result) { return this.normalizeWithLength(result).v; }
851
+ normalize(result) {
852
+ return this.normalizeWithLength(result).v;
853
+ }
757
854
  /**
758
855
  * If this vector has nonzero length, divide by the length to change to a unit vector.
759
856
  * @returns true if normalization completed.
@@ -767,8 +864,31 @@ export class Vector3d extends XYZ {
767
864
  this.z *= a;
768
865
  return true;
769
866
  }
770
- /** Return the fractional projection of spaceVector onto this */
867
+ /** Create a normalized vector from the inputs.
868
+ * @param result optional result
869
+ * @returns undefined if and only if normalization fails
870
+ */
871
+ static createNormalized(x = 0, y = 0, z = 0, result) {
872
+ if (undefined === result)
873
+ result = Vector3d.create(x, y, z);
874
+ else
875
+ result.set(x, y, z);
876
+ if (result.normalizeInPlace())
877
+ return result;
878
+ return undefined;
879
+ }
880
+ /**
881
+ * Return fractional projection of target vector onto this
882
+ * * It's returning the signed projection magnitude divided by the target magnitude. In other words,
883
+ * it's returning the length of the projection as a fraction of the target magnitude.
884
+ * @param target the target vector
885
+ * @param defaultFraction the returned value in case magnitude square of target vector is very small
886
+ * */
771
887
  fractionOfProjectionToVector(target, defaultFraction = 0) {
888
+ /*
889
+ * projection length is (this.target)/||target||
890
+ * but here we return (this.target)/||target||^2
891
+ */
772
892
  const numerator = this.dotProduct(target);
773
893
  const denominator = target.magnitudeSquared();
774
894
  if (denominator < Geometry.smallMetricDistanceSquared)
@@ -788,7 +908,7 @@ export class Vector3d extends XYZ {
788
908
  /** Return a vector same length as this but rotate 90 degrees CCW */
789
909
  rotate90CCWXY(result) {
790
910
  result = result ? result : new Vector3d();
791
- // save x,y to allow aliasing ..
911
+ // save x,y to allow aliasing ("this" can be passed to the function as "result")
792
912
  const xx = this.x;
793
913
  const yy = this.y;
794
914
  result.x = -yy;
@@ -796,6 +916,17 @@ export class Vector3d extends XYZ {
796
916
  result.z = this.z;
797
917
  return result;
798
918
  }
919
+ /** Return a vector same length as this but rotated 90 degrees clockwise */
920
+ rotate90CWXY(result) {
921
+ result = result ? result : new Vector3d();
922
+ // save x,y to allow aliasing ("this" can be passed to the function as "result")
923
+ const xx = this.x;
924
+ const yy = this.y;
925
+ result.x = yy;
926
+ result.y = -xx;
927
+ result.z = this.z;
928
+ return result;
929
+ }
799
930
  /**
800
931
  * Return a vector which is in the xy plane, perpendicular ot the xy part of this vector, and of unit length.
801
932
  * * If the xy part is 00, the return is the rotated (but not normalized) xy parts of this vector.
@@ -805,6 +936,7 @@ export class Vector3d extends XYZ {
805
936
  result = result ? result : new Vector3d();
806
937
  const xx = this.x;
807
938
  const yy = this.y;
939
+ // save x,y to allow aliasing ("this" can be passed to the function as "result")
808
940
  result.x = -yy;
809
941
  result.y = xx;
810
942
  result.z = 0.0;
@@ -834,17 +966,23 @@ export class Vector3d extends XYZ {
834
966
  return result;
835
967
  }
836
968
  /**
837
- * Return a (new or optionally preallocated) vector that is rotated 90 degrees in the plane of this vector and the target vector.
969
+ * Return a (new or optionally preallocated) vector that is rotated 90 degrees in
970
+ * the plane of this vector and the target vector.
838
971
  * @param target Second vector which defines the plane of rotation.
839
972
  * @param result optional preallocated vector for result.
840
- * @returns rotated vector, or undefined if the cross product of this and the the target cannot be normalized (i.e. if the target and this are colinear)
973
+ * @returns rotated vector, or undefined if the cross product of this and
974
+ * the the target cannot be normalized (i.e. if the target and this are colinear)
841
975
  */
842
976
  rotate90Towards(target, result) {
843
977
  const normal = this.crossProduct(target).normalize();
844
978
  return normal ? normal.crossProduct(this, result) : undefined;
845
979
  }
846
980
  /** Rotate this vector 90 degrees around an axis vector.
847
- * @returns the (new or optionally reused result) rotated vector, or undefined if the axis vector cannot be normalized.
981
+ * * Note that simple cross is in the plane perpendicular to axis -- it loses the part
982
+ * of "this" that is along the axis. The unit and scale is supposed to fix that.
983
+ * This matches with Rodrigues' rotation formula because cos(theta) = 0 and sin(theta) = 1
984
+ * @returns the (new or optionally reused result) rotated vector, or undefined if the axis
985
+ * vector cannot be normalized.
848
986
  */
849
987
  rotate90Around(axis, result) {
850
988
  const unitNormal = axis.normalize();
@@ -852,12 +990,17 @@ export class Vector3d extends XYZ {
852
990
  }
853
991
  /**
854
992
  * Return a vector computed at fractional position between this vector and vectorB
855
- * @param fraction fractional position. 0 is at `this`. 1 is at `vectorB`. True fractions are "between", negatives are "before this", beyond 1 is "beyond vectorB".
993
+ * @param fraction fractional position. 0 is at `this`. 1 is at `vectorB`.
994
+ * True fractions are "between", negatives are "before this", beyond 1 is "beyond vectorB".
856
995
  * @param vectorB second vector
857
996
  * @param result optional preallocated result.
858
997
  */
859
998
  interpolate(fraction, vectorB, result) {
860
999
  result = result ? result : new Vector3d();
1000
+ /*
1001
+ * For best last-bit behavior, if fraction is below 0.5, use this as base point.
1002
+ * If above 0.5, use vectorB as base point.
1003
+ */
861
1004
  if (fraction <= 0.5) {
862
1005
  result.x = this.x + fraction * (vectorB.x - this.x);
863
1006
  result.y = this.y + fraction * (vectorB.y - this.y);
@@ -923,7 +1066,8 @@ export class Vector3d extends XYZ {
923
1066
  static createAdd2Scaled(vectorA, scaleA, vectorB, scaleB, result) {
924
1067
  return Vector3d.create(vectorA.x * scaleA + vectorB.x * scaleB, vectorA.y * scaleA + vectorB.y * scaleB, vectorA.z * scaleA + vectorB.z * scaleB, result);
925
1068
  }
926
- /** Return the (strongly typed Vector3d) `thisVector3d + vectorA * scalarA + vectorB * scalarB` with all components presented as numbers */
1069
+ /** Return the (strongly typed Vector3d) `thisVector3d + vectorA * scalarA + vectorB * scalarB`
1070
+ * with all components presented as numbers */
927
1071
  static createAdd2ScaledXYZ(ax, ay, az, scaleA, bx, by, bz, scaleB, result) {
928
1072
  return Vector3d.create(ax * scaleA + bx * scaleB, ay * scaleA + by * scaleB, az * scaleA + bz * scaleB, result);
929
1073
  }
@@ -958,7 +1102,8 @@ export class Vector3d extends XYZ {
958
1102
  return this.crossProduct(vectorB, result).normalize(result);
959
1103
  }
960
1104
  /**
961
- * Compute the cross product of this vector with `vectorB`. Normalize it, using given xyz as default if length is zero.
1105
+ * Compute the cross product of this vector with `vectorB`. Normalize it, using given xyz as
1106
+ * default if length is zero.
962
1107
  * @param vectorB second vector of cross product
963
1108
  * @param x x value for default result
964
1109
  * @param y y value for default result
@@ -1002,7 +1147,8 @@ export class Vector3d extends XYZ {
1002
1147
  return true;
1003
1148
  }
1004
1149
  /**
1005
- * Compute cross product with `vectorB`.
1150
+ * Compute cross product with `vectorB`
1151
+ * * cross product vector will have the given length.
1006
1152
  * @param vectorB second vector for cross product.
1007
1153
  * @param productLength desired length of result vector.
1008
1154
  * @param result optional preallocated vector
@@ -1091,17 +1237,18 @@ export class Vector3d extends XYZ {
1091
1237
  return this.x * (pointB.x - pointA.x)
1092
1238
  + this.y * (pointB.y - pointA.y);
1093
1239
  }
1094
- /** Dot product with vector from pointA to pointB, with pointB given as (weighted) x,y,z,w
1095
- * * pointB is a homogeneous point that has to be unweighted
1240
+ /** Dot product with vector from pointA to pointB, with pointB given as (weighted) wx,wy,wz,w
1241
+ * * We need to unweight pointB (which is a homogeneous point) to be able to participate in the
1242
+ * vector dot product
1096
1243
  * * if the weight is near zero metric, the return is zero.
1097
1244
  */
1098
- dotProductStartEndXYZW(pointA, x, y, z, w) {
1245
+ dotProductStartEndXYZW(pointA, wx, wy, wz, w) {
1099
1246
  if (Geometry.isSmallMetricDistance(w))
1100
1247
  return 0.0;
1101
1248
  const dw = 1.0 / w;
1102
- return this.x * (dw * x - pointA.x)
1103
- + this.y * (dw * y - pointA.y)
1104
- + this.z * (dw * z - pointA.z);
1249
+ return this.x * (dw * wx - pointA.x)
1250
+ + this.y * (dw * wy - pointA.y)
1251
+ + this.z * (dw * wz - pointA.z);
1105
1252
  }
1106
1253
  /** Return the dot product of the instance and vectorB, using only the x and y parts. */
1107
1254
  dotProductXY(vectorB) {
@@ -1143,133 +1290,167 @@ export class Vector3d extends XYZ {
1143
1290
  return Vector3d.createCrossProduct(this.x, this.y, this.z, x, y, z, result);
1144
1291
  }
1145
1292
  /**
1146
- * Return the (Strongly typed) angle from this vector to vectorB.
1293
+ * Return the (radians as a simple number, not strongly typed Angle) angle from this vector to vectorB.
1294
+ * * The returned angle is always positive and no larger than 180 degrees (PI radians)
1295
+ * * The returned angle is "in the plane containing the two vectors"
1296
+ * * Use `planarRadiansTo` and `signedRadiansTo` to take have angle measured in specific plane.
1297
+ * @param vectorB target vector.
1298
+ */
1299
+ radiansTo(vectorB) {
1300
+ // ||axb|| = ||a|| ||b|| |sin(t)| and a.b = ||a|| ||b|| cos(t) ==>
1301
+ // ||axb|| / a.b = sin(t)/cos(t) = tan(t) ==> t = arctan(||axb|| / a.b).
1302
+ return Math.atan2(this.crossProductMagnitude(vectorB), this.dotProduct(vectorB));
1303
+ }
1304
+ /**
1305
+ * Return the (strongly typed) angle from this vector to vectorB.
1147
1306
  * * The returned angle is always positive and no larger than 180 degrees (PI radians)
1148
1307
  * * The returned angle is "in the plane containing the two vectors"
1149
- * * Use `planarAngleTo`, `signedAngleTo`, `angleToXY` to take have angle measured in specific plane.
1150
- * @param vectorB target vector of rotation.
1308
+ * * Use `planarAngleTo` and `signedAngleTo` to take have angle measured in specific plane.
1309
+ * @param vectorB target vector.
1151
1310
  */
1152
1311
  angleTo(vectorB) {
1153
- return Angle.createAtan2(this.crossProductMagnitude(vectorB), this.dotProduct(vectorB));
1312
+ return Angle.createRadians(this.radiansTo(vectorB));
1154
1313
  }
1155
1314
  /**
1156
- * Return the (Strongly typed) angle from this vector to the plane perpendicular to planeNormal.
1315
+ * Return the (strongly typed) angle from this vector to the plane perpendicular to planeNormal.
1157
1316
  * * The returned vector is signed
1158
- * * The returned vector is (as degrees) always less than or equal to 90 degrees.
1159
- * @param planeNormal a normal vector to the plane
1317
+ * * The returned vector is (as degrees) always between -90 and 90 degrees.
1318
+ * * The function returns "PI/2 - angleTo(planeNormal)"
1319
+ * @param planeNormal a normal vector to the plane.
1160
1320
  */
1161
- angleFromPerpendicular(vectorB) {
1162
- return Angle.createAtan2(this.dotProduct(vectorB), this.crossProductMagnitude(vectorB));
1321
+ angleFromPerpendicular(planeNormal) {
1322
+ return Angle.createAtan2(this.dotProduct(planeNormal), this.crossProductMagnitude(planeNormal));
1163
1323
  }
1164
1324
  /**
1165
- * Return the (Strongly typed) angle from this vector to vectorB,using only the xy parts.
1166
- * * The returned angle can range from negative 180 degrees (negative PI radians) to positive 180 degrees (positive PI radians), not closed on the negative side.
1167
- * * Use `planarAngleTo`, `signedAngleTo`, `angleToXY` to take have angle measured in other planes.
1168
- * @param vectorB target vector of rotation.
1325
+ * Return the (Strongly typed) angle from this vector to vectorB, using only the xy parts.
1326
+ * * The returned angle can range from negative 180 degrees (negative PI radians) to positive 180
1327
+ * * degrees (positive PI radians), not closed on the negative side.
1328
+ * * Use `planarAngleTo` and `signedAngleTo` to take have angle measured in other planes.
1329
+ * @param vectorB target vector.
1169
1330
  */
1170
1331
  angleToXY(vectorB) {
1171
1332
  return Angle.createAtan2(this.crossProductXY(vectorB), this.dotProductXY(vectorB));
1172
1333
  }
1173
1334
  /**
1174
- * Return the (radians as a simple number, not strongly typed Angle) radians from this vector to vectorB.
1335
+ * Return the (simple number of radians, not Strongly typed Angle) angle from this vector to vectorB, measured
1336
+ * in the plane containing both, with vectorW indicating which side to view to control sign of the angle.
1337
+ * * The returned angle can range from negative PI to positive PI (not closed on negative side)
1338
+ * * The returned angle is "in the plane containing the two vectors"
1339
+ * * The returned angle has the same sign as vectorW dot product (thisVector cross vectorB)
1340
+ * * vectorW does not have to be perpendicular to the plane.
1341
+ * * Use planarRadiansTo to measure the angle between vectors that are projected to another plane.
1342
+ * @param vectorB target vector.
1343
+ * @param vectorW distinguishes between the sides of the plane.
1344
+ */
1345
+ signedRadiansTo(vectorB, vectorW) {
1346
+ const p = this.crossProduct(vectorB);
1347
+ const theta = Math.atan2(p.magnitude(), this.dotProduct(vectorB));
1348
+ if (vectorW.dotProduct(p) < 0.0)
1349
+ return -theta;
1350
+ else
1351
+ return theta;
1352
+ }
1353
+ /**
1354
+ * Return the (strongly typed Angle) angle from this vector to vectorB, measured in the plane containing both,
1355
+ * with vectorW indicating which side to view to control sign of the angle.
1356
+ * * The returned angle can range from negative 180 degrees (negative PI radians) to positive 180 degrees
1357
+ * * (positive PI radians), not closed on the negative side.
1358
+ * * The returned angle is "in the plane containing the two vectors"
1359
+ * * `vectorW` distinguishes between the sides of the plane, but does not have to be perpendicular.
1360
+ * * The returned angle has the same sign as vectorW dot product (thisVector cross vectorB)
1361
+ * * Use planarRadiansTo to measure the angle between vectors that are projected to another plane.
1362
+ * @param vectorB target vector.
1363
+ * @param vectorW distinguishes between the sides of the plane.
1364
+ */
1365
+ signedAngleTo(vectorB, vectorW) {
1366
+ return Angle.createRadians(this.signedRadiansTo(vectorB, vectorW));
1367
+ }
1368
+ /**
1369
+ * Return the radians (as a simple number, not strongly typed Angle) from this vector to vectorB,
1370
+ * measured between their projections to the plane with the given normal.
1175
1371
  * * The returned angle can be positive or negative, with magnitude no larger than PI radians
1176
- * * Use signedRadiansTo` to take have angle measured in other planes.
1177
- * @param vectorB target vector of rotation.
1372
+ * @param vectorB target vector
1373
+ * @param planeNormal the normal vector to the plane.
1178
1374
  */
1179
- planarRadiansTo(vector, planeNormal) {
1375
+ planarRadiansTo(vectorB, planeNormal) {
1180
1376
  const square = planeNormal.dotProduct(planeNormal);
1181
1377
  if (square === 0.0)
1182
1378
  return 0.0;
1183
1379
  const factor = 1.0 / square;
1184
- const projection0 = this.plusScaled(planeNormal, -this.dotProduct(planeNormal) * factor);
1185
- const projection1 = vector.plusScaled(planeNormal, -vector.dotProduct(planeNormal) * factor);
1186
- return projection0.signedRadiansTo(projection1, planeNormal);
1380
+ /*
1381
+ * projection of vector 'v' on normal 'n' is given by vProj = [dot(v,n)/||n||^2]*n
1382
+ * and projection of 'v' on the plane is given by 'v - vProj'
1383
+ */
1384
+ const thisProj = this.plusScaled(planeNormal, -this.dotProduct(planeNormal) * factor);
1385
+ const vectorBProj = vectorB.plusScaled(planeNormal, -vectorB.dotProduct(planeNormal) * factor);
1386
+ return thisProj.signedRadiansTo(vectorBProj, planeNormal);
1187
1387
  }
1188
1388
  /**
1189
- * Return the (as strongly typed Angle) Angle from this vector to vectorB.
1389
+ * Return the angle (as strongly typed Angle) from this vector to vectorB,
1390
+ * measured between their projections to the plane with the given normal.
1190
1391
  * * The returned angle can range from negative PI to positive PI (not closed on negative side)
1191
- * * Use signedRadiansTo` to take have angle measured in other planes.
1192
- * @param vectorB target vector of rotation.
1392
+ * @param vectorB target vector.
1393
+ * @param planeNormal the normal vector to the plane.
1193
1394
  */
1194
- planarAngleTo(vector, planeNormal) {
1195
- return Angle.createRadians(this.planarRadiansTo(vector, planeNormal));
1395
+ planarAngleTo(vectorB, planeNormal) {
1396
+ return Angle.createRadians(this.planarRadiansTo(vectorB, planeNormal));
1196
1397
  }
1197
- /**
1198
- * Return the (simple number of radians, not Strongly typed Angle) angle from this vector to vectorB, measured in the plane containing both, with vectorW indicating which side to view to control sign of the angle.
1199
- * * The returned angle can range from negative PI to positive PI (not closed on negative side)
1200
- * * The returned angle is "in the plane containing the two vectors"
1201
- * * `vectorW` distinguishes between the sides of the plane, but does not have to be perpendicular.
1202
- * * The returned angle has the same sign as vectorW dot product (thisVector cross vectorB)
1203
- * @param vectorB target vector of rotation.
1204
- */
1205
- signedRadiansTo(vector1, vectorW) {
1206
- const p = this.crossProduct(vector1);
1207
- const theta = Math.atan2(p.magnitude(), this.dotProduct(vector1));
1208
- if (vectorW.dotProduct(p) < 0.0)
1209
- return -theta;
1210
- else
1211
- return theta;
1212
- }
1213
- /**
1214
- * Return the (strongly typed Angle) angle from this vector to vectorB, measured in the plane containing both, with vectorW indicating which side to view to control sign of the angle.
1215
- * * The returned angle can range from negative 180 degrees (negative PI radians) to positive 180 degrees (positive PI radians), not closed on the negative side.
1216
- * * The returned angle is "in the plane containing the two vectors"
1217
- * * `vectorW` distinguishes between the sides of the plane, but does not have to be perpendicular.
1218
- * * The returned angle has the same sign as vectorW dot product (thisVector cross vectorB)
1219
- * @param vectorB target vector of rotation.
1220
- */
1221
- signedAngleTo(vector1, vectorW) { return Angle.createRadians(this.signedRadiansTo(vector1, vectorW)); }
1222
- /** Return the smallest (strongly typed) angle from the (bidirectional) line containing `this` to the (bidirectional) line containing `vectorB` */
1223
- smallerUnorientedAngleTo(vectorB) {
1224
- return Angle.createRadians(this.smallerUnorientedRadiansTo(vectorB));
1225
- }
1226
- /** Return the smallest angle (in radians) from the (bidirectional) line containing `this` to the (bidirectional) line containing `vectorB` */
1398
+ /** Return the smallest angle (in radians) from the (bidirectional) line containing `this`
1399
+ * to the (bidirectional) line containing `vectorB` */
1227
1400
  smallerUnorientedRadiansTo(vectorB) {
1228
1401
  const c = this.dotProduct(vectorB);
1229
1402
  const s = this.crossProductMagnitude(vectorB);
1230
1403
  return Math.atan2(Math.abs(s), Math.abs(c));
1231
1404
  }
1232
- /*
1233
- signedAngleTo(vectorB: Vector3d, upVector: Vector3d): Angle { }
1234
- // sectors
1235
- isInSmallerSector(vectorA: Vector3d, vectorB: Vector3d): boolean { }
1236
- isInCCWSector(vectorA: Vector3d, vectorB: Vector3d, upVector: Vector3d): boolean { }
1237
- */
1405
+ /** Return the smallest (strongly typed) angle from the (bidirectional) line containing `this`
1406
+ * to the (bidirectional) line containing `vectorB` */
1407
+ smallerUnorientedAngleTo(vectorB) {
1408
+ return Angle.createRadians(this.smallerUnorientedRadiansTo(vectorB));
1409
+ }
1238
1410
  /**
1239
1411
  * Test if this vector is parallel to other.
1412
+ * * The input tolerances in `options`, if given, are considered to be squared for efficiency's sake,
1413
+ * so if you have a distance or angle tolerance t, you should pass in t * t.
1240
1414
  * @param other second vector in comparison
1241
- * @param oppositeIsParallel if the vectors are on the same line but in opposite directions, return this value.
1415
+ * @param oppositeIsParallel whether to consider diametrically opposed vectors as parallel
1242
1416
  * @param returnValueIfAnInputIsZeroLength if either vector is near zero length, return this value.
1417
+ * @param options optional radian and distance tolerances.
1243
1418
  */
1244
- isParallelTo(other, oppositeIsParallel = false, returnValueIfAnInputIsZeroLength = false) {
1419
+ isParallelTo(other, oppositeIsParallel = false, returnValueIfAnInputIsZeroLength = false, options) {
1420
+ var _a, _b;
1421
+ const radianSquaredTol = (_a = options === null || options === void 0 ? void 0 : options.radianSquaredTol) !== null && _a !== void 0 ? _a : Geometry.smallAngleRadiansSquared;
1422
+ const distanceSquaredTol = (_b = options === null || options === void 0 ? void 0 : options.distanceSquaredTol) !== null && _b !== void 0 ? _b : Geometry.smallMetricDistanceSquared;
1245
1423
  const a2 = this.magnitudeSquared();
1246
1424
  const b2 = other.magnitudeSquared();
1247
- // we know both are 0 or positive -- no need for
1248
- if (a2 < Geometry.smallMetricDistanceSquared || b2 < Geometry.smallMetricDistanceSquared)
1425
+ if (a2 < distanceSquaredTol || b2 < distanceSquaredTol)
1249
1426
  return returnValueIfAnInputIsZeroLength;
1250
1427
  const dot = this.dotProduct(other);
1251
1428
  if (dot < 0.0 && !oppositeIsParallel)
1252
- return returnValueIfAnInputIsZeroLength;
1429
+ return false;
1253
1430
  const cross2 = this.crossProductMagnitudeSquared(other);
1254
1431
  /* a2,b2,cross2 are squared lengths of respective vectors */
1255
1432
  /* cross2 = sin^2(theta) * a2 * b2 */
1256
1433
  /* For small theta, sin^2(theta)~~theta^2 */
1257
- return cross2 <= Geometry.smallAngleRadiansSquared * a2 * b2;
1434
+ return cross2 <= radianSquaredTol * a2 * b2;
1258
1435
  }
1259
1436
  /**
1260
1437
  * Test if this vector is perpendicular to other.
1438
+ * * The input tolerances in `options`, if given, are considered to be squared for efficiency's sake,
1439
+ * so if you have a distance or angle tolerance t, you should pass in t * t.
1261
1440
  * @param other second vector in comparison
1262
1441
  * @param returnValueIfAnInputIsZeroLength if either vector is near zero length, return this value.
1442
+ * @param options optional radian and distance tolerances.
1263
1443
  */
1264
- isPerpendicularTo(other, returnValueIfAnInputIsZeroLength = false) {
1444
+ isPerpendicularTo(other, returnValueIfAnInputIsZeroLength = false, options) {
1445
+ var _a, _b;
1446
+ const radianSquaredTol = (_a = options === null || options === void 0 ? void 0 : options.radianSquaredTol) !== null && _a !== void 0 ? _a : Geometry.smallAngleRadiansSquared;
1447
+ const distanceSquaredTol = (_b = options === null || options === void 0 ? void 0 : options.distanceSquaredTol) !== null && _b !== void 0 ? _b : Geometry.smallMetricDistanceSquared;
1265
1448
  const aa = this.magnitudeSquared();
1266
- if (aa < Geometry.smallMetricDistanceSquared)
1267
- return returnValueIfAnInputIsZeroLength;
1268
1449
  const bb = other.magnitudeSquared();
1269
- if (bb < Geometry.smallMetricDistanceSquared)
1450
+ if (aa < distanceSquaredTol || bb < distanceSquaredTol)
1270
1451
  return returnValueIfAnInputIsZeroLength;
1271
1452
  const ab = this.dotProduct(other);
1272
- return ab * ab <= Geometry.smallAngleRadiansSquared * aa * bb;
1453
+ return ab * ab <= radianSquaredTol * aa * bb;
1273
1454
  }
1274
1455
  }
1275
1456
  //# sourceMappingURL=Point3dVector3d.js.map