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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (342) hide show
  1. package/CHANGELOG.md +65 -1
  2. package/lib/cjs/Geometry.d.ts +26 -10
  3. package/lib/cjs/Geometry.d.ts.map +1 -1
  4. package/lib/cjs/Geometry.js +32 -17
  5. package/lib/cjs/Geometry.js.map +1 -1
  6. package/lib/cjs/bspline/BSplineCurve.d.ts +11 -5
  7. package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
  8. package/lib/cjs/bspline/BSplineCurve.js +47 -18
  9. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  10. package/lib/cjs/bspline/BezierCurveBase.d.ts +10 -3
  11. package/lib/cjs/bspline/BezierCurveBase.d.ts.map +1 -1
  12. package/lib/cjs/bspline/BezierCurveBase.js +12 -4
  13. package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
  14. package/lib/cjs/bspline/InterpolationCurve3d.d.ts.map +1 -1
  15. package/lib/cjs/bspline/InterpolationCurve3d.js +4 -1
  16. package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
  17. package/lib/cjs/bspline/KnotVector.d.ts.map +1 -1
  18. package/lib/cjs/bspline/KnotVector.js +3 -0
  19. package/lib/cjs/bspline/KnotVector.js.map +1 -1
  20. package/lib/cjs/curve/Arc3d.d.ts +10 -4
  21. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  22. package/lib/cjs/curve/Arc3d.js +17 -5
  23. package/lib/cjs/curve/Arc3d.js.map +1 -1
  24. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +15 -7
  25. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  26. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +46 -29
  27. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  28. package/lib/cjs/curve/CurveCollection.d.ts +13 -4
  29. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  30. package/lib/cjs/curve/CurveCollection.js +23 -2
  31. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  32. package/lib/cjs/curve/CurveCurveIntersectXY.js +1 -1
  33. package/lib/cjs/curve/CurveCurveIntersectXY.js.map +1 -1
  34. package/lib/cjs/curve/CurveCurveIntersectXYZ.d.ts +4 -3
  35. package/lib/cjs/curve/CurveCurveIntersectXYZ.d.ts.map +1 -1
  36. package/lib/cjs/curve/CurveCurveIntersectXYZ.js +8 -6
  37. package/lib/cjs/curve/CurveCurveIntersectXYZ.js.map +1 -1
  38. package/lib/cjs/curve/CurvePrimitive.d.ts +20 -18
  39. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  40. package/lib/cjs/curve/CurvePrimitive.js +58 -339
  41. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  42. package/lib/cjs/curve/LineSegment3d.d.ts +8 -2
  43. package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
  44. package/lib/cjs/curve/LineSegment3d.js +9 -0
  45. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  46. package/lib/cjs/curve/LineString3d.d.ts +18 -2
  47. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  48. package/lib/cjs/curve/LineString3d.js +39 -23
  49. package/lib/cjs/curve/LineString3d.js.map +1 -1
  50. package/lib/cjs/curve/ProxyCurve.d.ts +9 -7
  51. package/lib/cjs/curve/ProxyCurve.d.ts.map +1 -1
  52. package/lib/cjs/curve/ProxyCurve.js +4 -0
  53. package/lib/cjs/curve/ProxyCurve.js.map +1 -1
  54. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +2 -1
  55. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  56. package/lib/cjs/curve/Query/PlanarSubdivision.js +5 -4
  57. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  58. package/lib/cjs/curve/RegionOps.d.ts +5 -0
  59. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  60. package/lib/cjs/curve/RegionOps.js +17 -3
  61. package/lib/cjs/curve/RegionOps.js.map +1 -1
  62. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts +9 -6
  63. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  64. package/lib/cjs/curve/RegionOpsClassificationSweeps.js +55 -47
  65. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  66. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts +55 -0
  67. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts.map +1 -0
  68. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js +143 -0
  69. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -0
  70. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts +43 -0
  71. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -0
  72. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js +146 -0
  73. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -0
  74. package/lib/cjs/curve/internalContexts/CurveLengthContext.d.ts +33 -0
  75. package/lib/cjs/curve/internalContexts/CurveLengthContext.d.ts.map +1 -0
  76. package/lib/cjs/curve/internalContexts/CurveLengthContext.js +91 -0
  77. package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -0
  78. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts +21 -0
  79. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts.map +1 -0
  80. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js +34 -0
  81. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -0
  82. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +31 -8
  83. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
  84. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js +77 -12
  85. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  86. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts +2 -2
  87. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  88. package/lib/cjs/curve/spiral/DirectSpiral3d.js +15 -8
  89. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  90. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts +12 -7
  91. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  92. package/lib/cjs/curve/spiral/TransitionSpiral3d.js +12 -3
  93. package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
  94. package/lib/cjs/geometry3d/Angle.d.ts +66 -42
  95. package/lib/cjs/geometry3d/Angle.d.ts.map +1 -1
  96. package/lib/cjs/geometry3d/Angle.js +201 -99
  97. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  98. package/lib/cjs/geometry3d/AngleSweep.d.ts +102 -60
  99. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  100. package/lib/cjs/geometry3d/AngleSweep.js +191 -106
  101. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  102. package/lib/cjs/geometry3d/Matrix3d.d.ts +25 -8
  103. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  104. package/lib/cjs/geometry3d/Matrix3d.js +67 -15
  105. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  106. package/lib/cjs/geometry3d/Point2dArrayCarrier.d.ts +1 -0
  107. package/lib/cjs/geometry3d/Point2dArrayCarrier.d.ts.map +1 -1
  108. package/lib/cjs/geometry3d/Point2dArrayCarrier.js +2 -1
  109. package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
  110. package/lib/cjs/geometry3d/Point2dVector2d.d.ts +86 -25
  111. package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
  112. package/lib/cjs/geometry3d/Point2dVector2d.js +230 -81
  113. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  114. package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts +14 -4
  115. package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  116. package/lib/cjs/geometry3d/Point3dArrayCarrier.js +15 -5
  117. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  118. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +121 -67
  119. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  120. package/lib/cjs/geometry3d/Point3dVector3d.js +318 -137
  121. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  122. package/lib/cjs/geometry3d/Range.d.ts +1 -2
  123. package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
  124. package/lib/cjs/geometry3d/Range.js +1 -2
  125. package/lib/cjs/geometry3d/Range.js.map +1 -1
  126. package/lib/cjs/geometry3d/Ray3d.d.ts +5 -5
  127. package/lib/cjs/geometry3d/Ray3d.js +5 -5
  128. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  129. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  130. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  131. package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
  132. package/lib/cjs/numerics/Polynomials.js +0 -1
  133. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  134. package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts +4 -4
  135. package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
  136. package/lib/cjs/polyface/IndexedEdgeMatcher.js +3 -3
  137. package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
  138. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  139. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  140. package/lib/cjs/polyface/Polyface.d.ts +7 -2
  141. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  142. package/lib/cjs/polyface/Polyface.js +8 -1
  143. package/lib/cjs/polyface/Polyface.js.map +1 -1
  144. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  145. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  146. package/lib/cjs/polyface/PolyfaceQuery.d.ts +36 -8
  147. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  148. package/lib/cjs/polyface/PolyfaceQuery.js +112 -31
  149. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  150. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  151. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  152. package/lib/cjs/serialization/IModelJsonSchema.d.ts +1 -1
  153. package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
  154. package/lib/cjs/serialization/IModelJsonSchema.js +4 -3
  155. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  156. package/lib/cjs/solid/Sphere.d.ts +1 -1
  157. package/lib/cjs/solid/Sphere.js +3 -3
  158. package/lib/cjs/solid/Sphere.js.map +1 -1
  159. package/lib/cjs/solid/TorusPipe.d.ts +17 -13
  160. package/lib/cjs/solid/TorusPipe.d.ts.map +1 -1
  161. package/lib/cjs/solid/TorusPipe.js +67 -38
  162. package/lib/cjs/solid/TorusPipe.js.map +1 -1
  163. package/lib/cjs/topology/Graph.d.ts +1 -1
  164. package/lib/cjs/topology/Graph.js +1 -1
  165. package/lib/cjs/topology/Graph.js.map +1 -1
  166. package/lib/cjs/topology/Merging.d.ts.map +1 -1
  167. package/lib/cjs/topology/Merging.js +9 -1
  168. package/lib/cjs/topology/Merging.js.map +1 -1
  169. package/lib/cjs/topology/Triangulation.d.ts +1 -1
  170. package/lib/cjs/topology/Triangulation.js +1 -1
  171. package/lib/cjs/topology/Triangulation.js.map +1 -1
  172. package/lib/esm/Geometry.d.ts +26 -10
  173. package/lib/esm/Geometry.d.ts.map +1 -1
  174. package/lib/esm/Geometry.js +32 -17
  175. package/lib/esm/Geometry.js.map +1 -1
  176. package/lib/esm/bspline/BSplineCurve.d.ts +11 -5
  177. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  178. package/lib/esm/bspline/BSplineCurve.js +47 -18
  179. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  180. package/lib/esm/bspline/BezierCurveBase.d.ts +10 -3
  181. package/lib/esm/bspline/BezierCurveBase.d.ts.map +1 -1
  182. package/lib/esm/bspline/BezierCurveBase.js +12 -4
  183. package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
  184. package/lib/esm/bspline/InterpolationCurve3d.d.ts.map +1 -1
  185. package/lib/esm/bspline/InterpolationCurve3d.js +4 -1
  186. package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
  187. package/lib/esm/bspline/KnotVector.d.ts.map +1 -1
  188. package/lib/esm/bspline/KnotVector.js +3 -0
  189. package/lib/esm/bspline/KnotVector.js.map +1 -1
  190. package/lib/esm/curve/Arc3d.d.ts +10 -4
  191. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  192. package/lib/esm/curve/Arc3d.js +17 -5
  193. package/lib/esm/curve/Arc3d.js.map +1 -1
  194. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +15 -7
  195. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  196. package/lib/esm/curve/CurveChainWithDistanceIndex.js +46 -29
  197. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  198. package/lib/esm/curve/CurveCollection.d.ts +13 -4
  199. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  200. package/lib/esm/curve/CurveCollection.js +23 -2
  201. package/lib/esm/curve/CurveCollection.js.map +1 -1
  202. package/lib/esm/curve/CurveCurveIntersectXY.js +1 -1
  203. package/lib/esm/curve/CurveCurveIntersectXY.js.map +1 -1
  204. package/lib/esm/curve/CurveCurveIntersectXYZ.d.ts +4 -3
  205. package/lib/esm/curve/CurveCurveIntersectXYZ.d.ts.map +1 -1
  206. package/lib/esm/curve/CurveCurveIntersectXYZ.js +8 -6
  207. package/lib/esm/curve/CurveCurveIntersectXYZ.js.map +1 -1
  208. package/lib/esm/curve/CurvePrimitive.d.ts +20 -18
  209. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  210. package/lib/esm/curve/CurvePrimitive.js +52 -333
  211. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  212. package/lib/esm/curve/LineSegment3d.d.ts +8 -2
  213. package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
  214. package/lib/esm/curve/LineSegment3d.js +9 -0
  215. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  216. package/lib/esm/curve/LineString3d.d.ts +18 -2
  217. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  218. package/lib/esm/curve/LineString3d.js +39 -23
  219. package/lib/esm/curve/LineString3d.js.map +1 -1
  220. package/lib/esm/curve/ProxyCurve.d.ts +9 -7
  221. package/lib/esm/curve/ProxyCurve.d.ts.map +1 -1
  222. package/lib/esm/curve/ProxyCurve.js +4 -0
  223. package/lib/esm/curve/ProxyCurve.js.map +1 -1
  224. package/lib/esm/curve/Query/PlanarSubdivision.d.ts +2 -1
  225. package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  226. package/lib/esm/curve/Query/PlanarSubdivision.js +5 -4
  227. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  228. package/lib/esm/curve/RegionOps.d.ts +5 -0
  229. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  230. package/lib/esm/curve/RegionOps.js +17 -3
  231. package/lib/esm/curve/RegionOps.js.map +1 -1
  232. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts +9 -6
  233. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  234. package/lib/esm/curve/RegionOpsClassificationSweeps.js +56 -48
  235. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  236. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts +55 -0
  237. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts.map +1 -0
  238. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js +139 -0
  239. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -0
  240. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts +43 -0
  241. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -0
  242. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js +142 -0
  243. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -0
  244. package/lib/esm/curve/internalContexts/CurveLengthContext.d.ts +33 -0
  245. package/lib/esm/curve/internalContexts/CurveLengthContext.d.ts.map +1 -0
  246. package/lib/esm/curve/internalContexts/CurveLengthContext.js +87 -0
  247. package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -0
  248. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts +21 -0
  249. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts.map +1 -0
  250. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js +30 -0
  251. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -0
  252. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +31 -8
  253. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
  254. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js +77 -12
  255. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  256. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts +2 -2
  257. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  258. package/lib/esm/curve/spiral/DirectSpiral3d.js +15 -8
  259. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  260. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts +12 -7
  261. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  262. package/lib/esm/curve/spiral/TransitionSpiral3d.js +12 -3
  263. package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
  264. package/lib/esm/geometry3d/Angle.d.ts +66 -42
  265. package/lib/esm/geometry3d/Angle.d.ts.map +1 -1
  266. package/lib/esm/geometry3d/Angle.js +201 -99
  267. package/lib/esm/geometry3d/Angle.js.map +1 -1
  268. package/lib/esm/geometry3d/AngleSweep.d.ts +102 -60
  269. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  270. package/lib/esm/geometry3d/AngleSweep.js +191 -106
  271. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  272. package/lib/esm/geometry3d/Matrix3d.d.ts +25 -8
  273. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  274. package/lib/esm/geometry3d/Matrix3d.js +67 -15
  275. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  276. package/lib/esm/geometry3d/Point2dArrayCarrier.d.ts +1 -0
  277. package/lib/esm/geometry3d/Point2dArrayCarrier.d.ts.map +1 -1
  278. package/lib/esm/geometry3d/Point2dArrayCarrier.js +2 -1
  279. package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
  280. package/lib/esm/geometry3d/Point2dVector2d.d.ts +86 -25
  281. package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
  282. package/lib/esm/geometry3d/Point2dVector2d.js +230 -81
  283. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  284. package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts +14 -4
  285. package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  286. package/lib/esm/geometry3d/Point3dArrayCarrier.js +15 -5
  287. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  288. package/lib/esm/geometry3d/Point3dVector3d.d.ts +121 -67
  289. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  290. package/lib/esm/geometry3d/Point3dVector3d.js +318 -137
  291. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  292. package/lib/esm/geometry3d/Range.d.ts +1 -2
  293. package/lib/esm/geometry3d/Range.d.ts.map +1 -1
  294. package/lib/esm/geometry3d/Range.js +1 -2
  295. package/lib/esm/geometry3d/Range.js.map +1 -1
  296. package/lib/esm/geometry3d/Ray3d.d.ts +5 -5
  297. package/lib/esm/geometry3d/Ray3d.js +5 -5
  298. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  299. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  300. package/lib/esm/geometry3d/Transform.js.map +1 -1
  301. package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
  302. package/lib/esm/numerics/Polynomials.js +0 -1
  303. package/lib/esm/numerics/Polynomials.js.map +1 -1
  304. package/lib/esm/polyface/IndexedEdgeMatcher.d.ts +4 -4
  305. package/lib/esm/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
  306. package/lib/esm/polyface/IndexedEdgeMatcher.js +3 -3
  307. package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
  308. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  309. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  310. package/lib/esm/polyface/Polyface.d.ts +7 -2
  311. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  312. package/lib/esm/polyface/Polyface.js +8 -1
  313. package/lib/esm/polyface/Polyface.js.map +1 -1
  314. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  315. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  316. package/lib/esm/polyface/PolyfaceQuery.d.ts +36 -8
  317. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  318. package/lib/esm/polyface/PolyfaceQuery.js +113 -32
  319. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  320. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  321. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  322. package/lib/esm/serialization/IModelJsonSchema.d.ts +1 -1
  323. package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
  324. package/lib/esm/serialization/IModelJsonSchema.js +4 -3
  325. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  326. package/lib/esm/solid/Sphere.d.ts +1 -1
  327. package/lib/esm/solid/Sphere.js +3 -3
  328. package/lib/esm/solid/Sphere.js.map +1 -1
  329. package/lib/esm/solid/TorusPipe.d.ts +17 -13
  330. package/lib/esm/solid/TorusPipe.d.ts.map +1 -1
  331. package/lib/esm/solid/TorusPipe.js +67 -38
  332. package/lib/esm/solid/TorusPipe.js.map +1 -1
  333. package/lib/esm/topology/Graph.d.ts +1 -1
  334. package/lib/esm/topology/Graph.js +1 -1
  335. package/lib/esm/topology/Graph.js.map +1 -1
  336. package/lib/esm/topology/Merging.d.ts.map +1 -1
  337. package/lib/esm/topology/Merging.js +9 -1
  338. package/lib/esm/topology/Merging.js.map +1 -1
  339. package/lib/esm/topology/Triangulation.d.ts +1 -1
  340. package/lib/esm/topology/Triangulation.js +1 -1
  341. package/lib/esm/topology/Triangulation.js.map +1 -1
  342. package/package.json +5 -5
@@ -7,30 +7,46 @@
7
7
  */
8
8
  import { Geometry } from "../Geometry";
9
9
  /**
10
- * An `Angle` carries the numeric value of an angle, with methods to allow (require!) callers to be clear about whether their angle is degrees or radians.
11
- * * The numeric value is private, and callers should not know or care whether it is in degrees or radians.
12
- * * The various access method are named so that callers can specify whether untyped numbers passed in or out are degrees or radians.
10
+ * An `Angle` carries the numeric value of an angle, with methods to allow (require!) callers to
11
+ * be clear about whether their angle is degrees or radians.
12
+ * * After the Angle object is created, the callers should not know or care whether it is stored in
13
+ * `degrees` or `radians` because both are available if requested by caller.
14
+ * * The various access method are named so that callers can specify whether untyped numbers passed in or
15
+ * out are degrees or radians.
13
16
  * @public
14
17
  */
15
18
  export class Angle {
16
- constructor(radians = 0, degrees) { this._radians = radians; this._degrees = degrees; }
19
+ constructor(radians = 0, degrees) {
20
+ this._radians = radians;
21
+ this._degrees = degrees;
22
+ }
17
23
  /** Return a new angle with the same content. */
18
- clone() { return new Angle(this._radians, this._degrees); }
24
+ clone() {
25
+ return new Angle(this._radians, this._degrees);
26
+ }
19
27
  /** Freeze this instance so it is read-only */
20
- freeze() { return Object.freeze(this); }
28
+ freeze() {
29
+ return Object.freeze(this);
30
+ }
21
31
  /**
22
32
  * Return a new Angle object for angle given in degrees.
23
33
  * @param degrees angle in degrees
24
34
  */
25
- static createDegrees(degrees) { return new Angle(Angle.degreesToRadians(degrees), degrees); }
35
+ static createDegrees(degrees) {
36
+ return new Angle(Angle.degreesToRadians(degrees), degrees);
37
+ }
26
38
  /**
27
39
  * Return a (new) Angle object for a value given in radians.
28
40
  * @param radians angle in radians
29
41
  */
30
- static createRadians(radians) { return new Angle(radians); }
42
+ static createRadians(radians) {
43
+ return new Angle(radians);
44
+ }
31
45
  /**
32
- * Return a (new) Angle object that is interpolated between two inputs
33
- * @param radians angle in radians
46
+ * Return a (new) Angle object that is interpolated between two inputs (based on a fraction)
47
+ * @param angle0 first angle in radians
48
+ * @param fraction the interpolation fraction
49
+ * @param angle1 second angle in radians
34
50
  */
35
51
  static createInterpolate(angle0, fraction, angle1) {
36
52
  return new Angle(Geometry.interpolate(angle0.radians, fraction, angle1.radians));
@@ -39,45 +55,49 @@ export class Angle {
39
55
  * Return a (new) Angle object, with angle scaled from existing angle.
40
56
  * @param scale scale factor to apply to angle.
41
57
  */
42
- cloneScaled(scale) { return new Angle(this.radians * scale); }
58
+ cloneScaled(scale) {
59
+ return new Angle(this.radians * scale);
60
+ }
43
61
  /**
44
62
  * Set this angle to a value given in radians.
45
63
  * @param radians angle given in radians
46
64
  */
47
- setRadians(radians) { this._radians = radians; this._degrees = undefined; }
65
+ setRadians(radians) {
66
+ this._radians = radians;
67
+ this._degrees = undefined;
68
+ }
48
69
  /**
49
70
  * Set this angle to a value given in degrees.
50
71
  * @param degrees angle given in degrees.
51
72
  */
52
- setDegrees(degrees) { this._radians = Angle.degreesToRadians(degrees); this._degrees = degrees; }
73
+ setDegrees(degrees) {
74
+ this._radians = Angle.degreesToRadians(degrees);
75
+ this._degrees = degrees;
76
+ }
53
77
  /** Create an angle for a full circle. */
54
- static create360() { return new Angle(Math.PI * 2.0, 360.0); }
78
+ static create360() {
79
+ return new Angle(Math.PI * 2.0, 360.0);
80
+ }
55
81
  /**
56
- * @return a (strongly typed) Angle whose tangent is `numerator/denominator`, using the signs of both in determining the (otherwise ambiguous)
57
- * quadrant.
82
+ * Create a (strongly typed) Angle whose tangent is `numerator/denominator`, using the signs of both in
83
+ * determining the (otherwise ambiguous) quadrant.
58
84
  * @param numerator numerator for tangent
59
85
  * @param denominator denominator for tangent
60
86
  */
61
- static createAtan2(numerator, denominator) { return new Angle(Math.atan2(numerator, denominator)); }
87
+ static createAtan2(numerator, denominator) {
88
+ return new Angle(Math.atan2(numerator, denominator));
89
+ }
62
90
  /**
63
91
  * Copy all contents of `other` to this Angle.
64
92
  * @param other source data
65
93
  */
66
- setFrom(other) { this._radians = other._radians; this._degrees = other._degrees; }
67
- /**
68
- * Create an Angle from a JSON object
69
- * @param json object from JSON.parse. If a number, value is in *DEGREES*
70
- * @param defaultValRadians if json is undefined, default value in radians.
71
- * @return a new Angle
72
- */
73
- static fromJSON(json, defaultValRadians) {
74
- const val = new Angle();
75
- val.setFromJSON(json, defaultValRadians);
76
- return val;
94
+ setFrom(other) {
95
+ this._radians = other._radians;
96
+ this._degrees = other._degrees;
77
97
  }
78
98
  /**
79
- * set an Angle from a JSON object
80
- * * A simple number is degrees.
99
+ * Set an Angle from a JSON object
100
+ * * A simple number is considered as degrees.
81
101
  * * specified `json.degrees` or `json._degrees` is degree value.
82
102
  * * specified `son.radians` or `json._radians` is radians value.
83
103
  * @param json object from JSON.parse. If a number, value is in *DEGREES*
@@ -103,19 +123,40 @@ export class Angle {
103
123
  this.setRadians(json._radians);
104
124
  }
105
125
  }
126
+ /**
127
+ * Create an Angle from a JSON object
128
+ * @param json object from JSON.parse. If a number, value is in *DEGREES*
129
+ * @param defaultValRadians if json is undefined, default value in radians.
130
+ * @return a new Angle
131
+ */
132
+ static fromJSON(json, defaultValRadians) {
133
+ const val = new Angle();
134
+ val.setFromJSON(json, defaultValRadians);
135
+ return val;
136
+ }
106
137
  /** Convert an Angle to a JSON object as a number in degrees */
107
- toJSON() { return this.degrees; }
138
+ toJSON() {
139
+ return this.degrees;
140
+ }
108
141
  /** Return a json object with radians keyword, e.g. `{ radians: 0.10}` */
109
- toJSONRadians() { return { radians: this.radians }; }
110
- /** Return the angle measured in radians. */
111
- get radians() { return this._radians; }
112
- /** Return the angle measured in degrees. */
113
- get degrees() { return this._degrees !== undefined ? this._degrees : Angle.radiansToDegrees(this._radians); }
142
+ toJSONRadians() {
143
+ return { radians: this.radians };
144
+ }
145
+ /** Return the angle measured in radians. */
146
+ get radians() {
147
+ return this._radians;
148
+ }
149
+ /** Return the angle measured in degrees. */
150
+ get degrees() {
151
+ return this._degrees !== undefined ? this._degrees : Angle.radiansToDegrees(this._radians);
152
+ }
114
153
  /**
115
154
  * Convert an angle in degrees to radians.
116
155
  * @param degrees angle in degrees
117
156
  */
118
- static degreesToRadians(degrees) { return degrees * Math.PI / 180; }
157
+ static degreesToRadians(degrees) {
158
+ return degrees * Math.PI / 180;
159
+ }
119
160
  /**
120
161
  * Convert an angle in radians to degrees.
121
162
  * @param degrees angle in radians
@@ -126,6 +167,11 @@ export class Angle {
126
167
  // Now radians is positive ...
127
168
  const pi = Math.PI;
128
169
  const factor = 180.0 / pi;
170
+ /* the following if statements are for round-off reasons. The problem is that no IEEE number is
171
+ * an exact hit for any primary multiple of pi (90, 180, etc). The following is supposed to have
172
+ * a better chance that if the input was computed by direct assignment from 90, 180, etc degrees
173
+ * it will return exactly 90,180 etc.
174
+ */
129
175
  if (radians <= 0.25 * pi)
130
176
  return factor * radians;
131
177
  if (radians < 0.75 * pi)
@@ -140,27 +186,37 @@ export class Angle {
140
186
  /**
141
187
  * Return the cosine of this Angle object's angle.
142
188
  */
143
- cos() { return Math.cos(this._radians); }
189
+ cos() {
190
+ return Math.cos(this._radians);
191
+ }
144
192
  /**
145
193
  * Return the sine of this Angle object's angle.
146
194
  */
147
- sin() { return Math.sin(this._radians); }
195
+ sin() {
196
+ return Math.sin(this._radians);
197
+ }
148
198
  /**
149
199
  * Return the tangent of this Angle object's angle.
150
200
  */
151
- tan() { return Math.tan(this._radians); }
152
- /** Test if a radians (absolute) value is nearly 2PI or larger (!) */
201
+ tan() {
202
+ return Math.tan(this._radians);
203
+ }
204
+ /** Test if a radians (absolute) value is nearly 2PI or larger! */
153
205
  static isFullCircleRadians(radians) {
154
206
  return Math.abs(radians) >= Geometry.fullCircleRadiansMinusSmallAngle;
155
207
  }
156
- /** Test if the radians value is a complete circle */
208
+ /** Test if the radians value is a half circle */
157
209
  static isHalfCircleRadians(radians) {
158
210
  return Math.abs(Math.abs(radians) - Math.PI) <= Geometry.smallAngleRadians;
159
211
  }
160
- /** test if the angle is aa full circle */
161
- get isFullCircle() { return Angle.isFullCircleRadians(this._radians); }
212
+ /** test if the angle is a full circle */
213
+ get isFullCircle() {
214
+ return Angle.isFullCircleRadians(this._radians);
215
+ }
162
216
  /** test if the angle is a half circle (in either direction) */
163
- get isHalfCircle() { return Angle.isHalfCircleRadians(this._radians); }
217
+ get isHalfCircle() {
218
+ return Angle.isHalfCircleRadians(this._radians);
219
+ }
164
220
  /** Adjust a radians value so it is positive in 0..360 */
165
221
  static adjustDegrees0To360(degrees) {
166
222
  if (degrees >= 0) {
@@ -172,8 +228,8 @@ export class Angle {
172
228
  }
173
229
  else if (degrees < 0) {
174
230
  // negative angle ...
175
- const radians1 = Angle.adjustDegrees0To360(-degrees);
176
- return 360.0 - radians1;
231
+ const radians = Angle.adjustDegrees0To360(-degrees);
232
+ return 360.0 - radians;
177
233
  }
178
234
  // fall through for Nan (disaster) !!!
179
235
  return 0;
@@ -205,8 +261,7 @@ export class Angle {
205
261
  }
206
262
  else if (radians < 0) {
207
263
  // negative angle ...
208
- const radians1 = Angle.adjustRadians0To2Pi(-radians);
209
- return Math.PI * 2.0 - radians1;
264
+ return Math.PI * 2.0 - Angle.adjustRadians0To2Pi(-radians);
210
265
  }
211
266
  // fall through for NaN disaster.
212
267
  return 0;
@@ -228,53 +283,80 @@ export class Angle {
228
283
  return 0;
229
284
  }
230
285
  /** return a (newly allocated) Angle object with value 0 radians */
231
- static zero() { return new Angle(0); }
286
+ static zero() {
287
+ return new Angle(0);
288
+ }
232
289
  /** Test if the angle is exactly zero. */
233
- get isExactZero() { return this.radians === 0; }
290
+ get isExactZero() {
291
+ return this.radians === 0;
292
+ }
234
293
  /** Test if the angle is almost zero (within tolerance `Geometry.smallAngleRadians`) */
235
- get isAlmostZero() { return Math.abs(this.radians) < Geometry.smallAngleRadians; }
294
+ get isAlmostZero() {
295
+ return Math.abs(this.radians) < Geometry.smallAngleRadians;
296
+ }
236
297
  /** Test if the angle is almost a north or south pole (within tolerance `Geometry.smallAngleRadians`) */
237
- get isAlmostNorthOrSouthPole() { return Angle.isHalfCircleRadians(this.radians * 2.0); }
298
+ get isAlmostNorthOrSouthPole() {
299
+ return Angle.isHalfCircleRadians(this.radians * 2.0);
300
+ }
238
301
  /** Create an angle object with degrees adjusted into 0..360. */
239
- static createDegreesAdjustPositive(degrees) { return Angle.createDegrees(Angle.adjustDegrees0To360(degrees)); }
302
+ static createDegreesAdjustPositive(degrees) {
303
+ return Angle.createDegrees(Angle.adjustDegrees0To360(degrees));
304
+ }
240
305
  /** Create an angle object with degrees adjusted into -180..180. */
241
- static createDegreesAdjustSigned180(degrees) { return Angle.createDegrees(Angle.adjustDegreesSigned180(degrees)); }
306
+ static createDegreesAdjustSigned180(degrees) {
307
+ return Angle.createDegrees(Angle.adjustDegreesSigned180(degrees));
308
+ }
242
309
  /**
243
310
  * Test if two radians values are equivalent, allowing shift by full circle (i.e. by a multiple of `2*PI`)
244
311
  * @param radiansA first radians value
245
312
  * @param radiansB second radians value
313
+ * @param radianTol radian tolerance with default value of Geometry.smallAngleRadians
246
314
  */
247
- static isAlmostEqualRadiansAllowPeriodShift(radiansA, radiansB) {
248
- // try to get simple conclusions with un-shifted radians ...
315
+ static isAlmostEqualRadiansAllowPeriodShift(radiansA, radiansB, radianTol = Geometry.smallAngleRadians) {
249
316
  const delta = Math.abs(radiansA - radiansB);
250
- if (delta <= Geometry.smallAngleRadians)
317
+ if (delta <= radianTol)
251
318
  return true;
252
319
  const period = Math.PI * 2.0;
253
- if (Math.abs(delta - period) <= Geometry.smallAngleRadians)
320
+ if (Math.abs(delta - period) <= radianTol)
254
321
  return true;
255
322
  const numPeriod = Math.round(delta / period);
256
323
  const delta1 = delta - numPeriod * period;
257
- return Math.abs(delta1) <= Geometry.smallAngleRadians;
324
+ return Math.abs(delta1) <= radianTol;
258
325
  }
259
326
  /**
260
- * Test if this angle and other are equivalent, allowing shift by full circle (i.e. by a multiple of 360 degrees)
327
+ * Test if this angle and other are equivalent, allowing shift by full circle (i.e., multiples of `2 * PI`).
328
+ * @param other the other angle
329
+ * @param radianTol radian tolerance with default value of Geometry.smallAngleRadians
261
330
  */
262
- isAlmostEqualAllowPeriodShift(other) {
263
- return Angle.isAlmostEqualRadiansAllowPeriodShift(this._radians, other._radians);
331
+ isAlmostEqualAllowPeriodShift(other, radianTol = Geometry.smallAngleRadians) {
332
+ return Angle.isAlmostEqualRadiansAllowPeriodShift(this._radians, other._radians, radianTol);
264
333
  }
265
334
  /**
266
- * Test if two this angle and other are almost equal, NOT allowing shift by full circle multiples of 360 degrees.
335
+ * Test if two angle (in radians) almost equal, NOT allowing shift by full circle (i.e., multiples of `2 * PI`).
336
+ * @param radiansA first radians value
337
+ * @param radiansB second radians value
338
+ * @param radianTol radian tolerance with default value of Geometry.smallAngleRadians
267
339
  */
268
- isAlmostEqualNoPeriodShift(other) { return Math.abs(this._radians - other._radians) < Geometry.smallAngleRadians; }
340
+ static isAlmostEqualRadiansNoPeriodShift(radiansA, radiansB, radianTol = Geometry.smallAngleRadians) {
341
+ return Math.abs(radiansA - radiansB) < radianTol;
342
+ }
269
343
  /**
270
- * Test if two angle (in radians) almost equal, NOT allowing shift by full circle multiples of `2 * PI`.
271
- * * (Same test as isAlmostEqualRadiansNoPeriodShift)
344
+ * Test if two this angle and other are almost equal, NOT allowing shift by full circle (i.e., multiples of `2 * PI`).
345
+ * @param other the other angle
346
+ * @param radianTol radian tolerance with default value of Geometry.smallAngleRadians
272
347
  */
273
- isAlmostEqual(other) { return this.isAlmostEqualNoPeriodShift(other); }
348
+ isAlmostEqualNoPeriodShift(other, radianTol = Geometry.smallAngleRadians) {
349
+ return Angle.isAlmostEqualRadiansNoPeriodShift(this._radians, other._radians, radianTol);
350
+ }
274
351
  /**
275
- * Test if two angle (in radians) almost equal, NOT allowing shift by full circle multiples of `2 * PI`.
352
+ * Test if two this angle and other are almost equal, NOT allowing shift by full circle (i.e., multiples of `2 * PI`).
353
+ * * This function is same as isAlmostEqualRadiansNoPeriodShift. Please use isAlmostEqualRadiansNoPeriodShift.
354
+ * @param other the other angle
355
+ * @param radianTol radian tolerance with default value of Geometry.smallAngleRadians
276
356
  */
277
- static isAlmostEqualRadiansNoPeriodShift(radiansA, radiansB) { return Math.abs(radiansA - radiansB) < Geometry.smallAngleRadians; }
357
+ isAlmostEqual(other, radianTol = Geometry.smallAngleRadians) {
358
+ return this.isAlmostEqualNoPeriodShift(other, radianTol);
359
+ }
278
360
  /**
279
361
  * Test if dot product values indicate non-zero length perpendicular vectors.
280
362
  * @param dotUU dot product of vectorU with itself
@@ -287,40 +369,55 @@ export class Angle {
287
369
  && dotUV * dotUV <= Geometry.smallAngleRadiansSquared * dotUU * dotVV;
288
370
  }
289
371
  /**
290
- * Return cosine, sine, and radians for the half angle of a cosine,sine pair.
372
+ * Return cosine, sine, and radians for the half angle of a "cosine,sine" pair.
373
+ * * This function assumes the input arguments are related to an angle between -PI and PI
374
+ * * This function returns an angle between -PI and PI
291
375
  * @param rCos2A cosine value (scaled by radius) for initial angle.
292
376
  * @param rSin2A sine value (scaled by radius) for final angle.
293
377
  */
294
378
  static trigValuesToHalfAngleTrigValues(rCos2A, rSin2A) {
295
379
  const r = Geometry.hypotenuseXY(rCos2A, rSin2A);
296
380
  if (r < Geometry.smallMetricDistance) {
297
- return { c: 1.0, s: 0.0, radians: 0.0 };
381
+ return { c: 1.0, s: 0.0, radians: 0.0 }; // angle = 0
298
382
  }
299
383
  else {
300
- /* If the caller really gave you sine and cosine values, r should be 1. However,*/
301
- /* to allow scaled values -- e.g. the x and y components of any vector -- we normalize*/
302
- /* right here. This adds an extra sqrt and 2 divides to the whole process, but improves*/
303
- /* both the usefulness and robustness of the computation.*/
384
+ /* If the caller really gave you sine and cosine values, r should be 1. However,
385
+ * to allow scaled values -- e.g. the x and y components of any vector -- we normalize
386
+ * right here. This adds an extra sqrt and 2 divides to the whole process, but improves
387
+ * both the usefulness and robustness of the computation.
388
+ */
304
389
  let cosA;
305
390
  let sinA = 0.0;
306
391
  const cos2A = rCos2A / r;
307
392
  const sin2A = rSin2A / r;
393
+ // Original angle in NE and SE quadrants. Half angle in same quadrant
308
394
  if (cos2A >= 0.0) {
309
- /* Original angle in NE and SE quadrants. Half angle in same quadrant */
395
+ /*
396
+ * We know cos2A = (cosA)^2 - (sinA)^2 and 1 = (cosA)^2 + (sinA)^2
397
+ * so 1 + cos2A = 2(cosA)^2 and therefore, cosA = sqrt((1+cos2A)/2)
398
+ * cosine is positive in NE and SE quadrants so we use +sqrt
399
+ */
310
400
  cosA = Math.sqrt(0.5 * (1.0 + cos2A));
311
- sinA = sin2A / (2.0 * (cosA));
401
+ // We know sin2A = 2 sinA cosA so sinA = sin2A/(2*cosA)
402
+ sinA = sin2A / (2.0 * cosA);
312
403
  }
313
404
  else {
405
+ // Original angle in NW quadrant. Half angle in NE quadrant
314
406
  if (sin2A > 0.0) {
315
- /* Original angle in NW quadrant. Half angle in NE quadrant */
407
+ /*
408
+ * We know cos2A = (cosA)^2 - (sinA)^2 and 1 = (cosA)^2 + (sinA)^2
409
+ * so 1 - cos2A = 2(sinA)^2 and therefore, sinA = sqrt((1-cos2A)/2)
410
+ * sine is positive in NE quadrant so we use +sqrt
411
+ */
316
412
  sinA = Math.sqrt(0.5 * (1.0 - cos2A));
413
+ // Original angle in SW quadrant. Half angle in SE quadrant
317
414
  }
318
415
  else {
319
- /* Original angle in SW quadrant. Half angle in SE quadrant*/
320
- /* cosA comes out positive because both sines are negative. */
416
+ // sine is negative in SE quadrant so we use -sqrt
321
417
  sinA = -Math.sqrt(0.5 * (1.0 - cos2A));
322
418
  }
323
- cosA = sin2A / (2.0 * (sinA));
419
+ // We know sin2A = 2 sinA cosA so cosA = sin2A/(2*sinA)
420
+ cosA = sin2A / (2.0 * sinA); // always positive
324
421
  }
325
422
  return { c: cosA, s: sinA, radians: Math.atan2(sinA, cosA) };
326
423
  }
@@ -339,17 +436,24 @@ export class Angle {
339
436
  return value;
340
437
  }
341
438
  /**
342
- * Return the half angle cosine, sine, and radians for given dot products between vectors.
343
- * @param dotUU dot product of vectorU with itself
344
- * @param dotVV dot product of vectorV with itself
345
- * @param dotUV dot product of vectorU with vectorV
346
- */
439
+ * Return the half angle cosine, sine, and radians for given dot products between vectors. The vectors define
440
+ * an ellipse using x(t) = c + U cos(t) + V sin(t) so U and V are at angle t=0 degree and t=90 degree. The
441
+ * half angle t0 is an angle such that x(t0) is one of the ellipse semi-axis.
442
+ * * This construction arises e.g. in `Arc3d.toScaledMatrix3d`.
443
+ * * Given ellipse x(t) = c + U cos(t) + V sin(t), find t0 such that radial vector W(t0) = x(t0) - c is
444
+ * perpendicular to the ellipse.
445
+ * * Then 0 = W(t0).x'(t0) = (U cos(t0) + V sin(t0)).(V cos(t0) - U sin(t0)) = U.V cos(2t0) + 0.5 (V.V - U.U) sin(2t0)
446
+ * implies sin(2t0) / cos(2t0) = 2 U.V / (U.U - V.V), i.e., t0 can be computed given the three dot products on the RHS.
447
+ * @param dotUU dot product of vectorU with itself
448
+ * @param dotVV dot product of vectorV with itself
449
+ * @param dotUV dot product of vectorU with vectorV
450
+ */
347
451
  static dotProductsToHalfAngleTrigValues(dotUU, dotVV, dotUV, favorZero = true) {
348
- const rCos = dotUU - dotVV;
349
- const rSin = 2.0 * dotUV;
350
- if (favorZero && Math.abs(rSin) < Geometry.smallAngleRadians * (Math.abs(dotUU) + Math.abs(dotVV)))
452
+ const cos2t0 = dotUU - dotVV;
453
+ const sin2t0 = 2.0 * dotUV;
454
+ if (favorZero && Math.abs(sin2t0) < Geometry.smallAngleRadians * (Math.abs(dotUU) + Math.abs(dotVV)))
351
455
  return { c: 1.0, s: 0.0, radians: 0.0 };
352
- return Angle.trigValuesToHalfAngleTrigValues(rCos, rSin);
456
+ return Angle.trigValuesToHalfAngleTrigValues(cos2t0, sin2t0);
353
457
  }
354
458
  /**
355
459
  * * Returns the angle between two vectors, with the vectors given as xyz components
@@ -363,9 +467,7 @@ export class Angle {
363
467
  * @param vz z component of vector v
364
468
  */
365
469
  static radiansBetweenVectorsXYZ(ux, uy, uz, vx, vy, vz) {
366
- // const uu = ux * ux + uy * uy + uz * uz;
367
- const uDotV = ux * vx + uy * vy + uz * vz; // magU magV cos(theta)
368
- // const vv = vx * vx + vy * vy + vz * vz;
470
+ const uDotV = ux * vx + uy * vy + uz * vz;
369
471
  return Math.atan2(Geometry.crossProductMagnitude(ux, uy, uz, vx, vy, vz), uDotV);
370
472
  }
371
473
  /**
@@ -382,11 +484,13 @@ export class Angle {
382
484
  }
383
485
  }
384
486
  }
385
- /** maximal accuracy value of pi/4 ( 45 degrees), in radians */
487
+ /** maximal accuracy value of pi/12 (15 degrees), in radians */
488
+ Angle.piOver12Radians = 0.26179938779914943653855361527329;
489
+ /** maximal accuracy value of pi/4 (45 degrees), in radians */
386
490
  Angle.piOver4Radians = 7.85398163397448280000e-001;
387
- /** maximal accuracy value of pi/2 ( 90 degrees), in radians */
491
+ /** maximal accuracy value of pi/2 (90 degrees), in radians */
388
492
  Angle.piOver2Radians = 1.57079632679489660000e+000;
389
- /** maximal accuracy value of pi ( 180 degrees), in radians */
493
+ /** maximal accuracy value of pi (180 degrees), in radians */
390
494
  Angle.piRadians = 3.14159265358979310000e+000;
391
495
  /** maximal accuracy value of 2*pi (360 degrees), in radians */
392
496
  Angle.pi2Radians = 6.28318530717958620000e+000;
@@ -394,6 +498,4 @@ Angle.pi2Radians = 6.28318530717958620000e+000;
394
498
  Angle.degreesPerRadian = (45.0 / Angle.piOver4Radians);
395
499
  /** scale factor for converting degrees to radians */
396
500
  Angle.radiansPerDegree = (Angle.piOver4Radians / 45.0);
397
- /** maximal accuracy value of pi/12 ( 15 degrees), in radians */
398
- Angle.piOver12Radians = 0.26179938779914943653855361527329;
399
501
  //# sourceMappingURL=Angle.js.map