@itwin/core-geometry 4.0.0-dev.4 → 4.0.0-dev.41

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 (344) hide show
  1. package/CHANGELOG.md +17 -3
  2. package/lib/cjs/Geometry.d.ts +56 -16
  3. package/lib/cjs/Geometry.d.ts.map +1 -1
  4. package/lib/cjs/Geometry.js +87 -30
  5. package/lib/cjs/Geometry.js.map +1 -1
  6. package/lib/cjs/bspline/BSplineCurveOps.js +4 -5
  7. package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
  8. package/lib/cjs/bspline/InterpolationCurve3d.js +7 -10
  9. package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
  10. package/lib/cjs/clipping/ClipPrimitive.js +2 -2
  11. package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
  12. package/lib/cjs/clipping/ClipUtils.js +4 -4
  13. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  14. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js +2 -2
  15. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  16. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  17. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +20 -13
  18. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  19. package/lib/cjs/curve/CurveCollection.js +1 -1
  20. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  21. package/lib/cjs/curve/CurveCurve.d.ts +11 -8
  22. package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
  23. package/lib/cjs/curve/CurveCurve.js +16 -12
  24. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  25. package/lib/cjs/curve/CurveCurveIntersectXY.d.ts +5 -1
  26. package/lib/cjs/curve/CurveCurveIntersectXY.d.ts.map +1 -1
  27. package/lib/cjs/curve/CurveCurveIntersectXY.js +11 -10
  28. package/lib/cjs/curve/CurveCurveIntersectXY.js.map +1 -1
  29. package/lib/cjs/curve/Loop.d.ts +2 -2
  30. package/lib/cjs/curve/Loop.d.ts.map +1 -1
  31. package/lib/cjs/curve/Loop.js +6 -0
  32. package/lib/cjs/curve/Loop.js.map +1 -1
  33. package/lib/cjs/curve/RegionOps.d.ts +10 -10
  34. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  35. package/lib/cjs/curve/RegionOps.js +11 -11
  36. package/lib/cjs/curve/RegionOps.js.map +1 -1
  37. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts +2 -1
  38. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  39. package/lib/cjs/curve/RegionOpsClassificationSweeps.js +5 -2
  40. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  41. package/lib/cjs/curve/StrokeOptions.js +1 -2
  42. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  43. package/lib/cjs/curve/spiral/DirectSpiral3d.js +1 -2
  44. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  45. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +1 -2
  46. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  47. package/lib/cjs/geometry3d/Angle.d.ts +19 -0
  48. package/lib/cjs/geometry3d/Angle.d.ts.map +1 -1
  49. package/lib/cjs/geometry3d/Angle.js +39 -0
  50. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  51. package/lib/cjs/geometry3d/AngleSweep.d.ts +1 -0
  52. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  53. package/lib/cjs/geometry3d/AngleSweep.js +1 -0
  54. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  55. package/lib/cjs/geometry3d/BarycentricTriangle.d.ts +195 -8
  56. package/lib/cjs/geometry3d/BarycentricTriangle.d.ts.map +1 -1
  57. package/lib/cjs/geometry3d/BarycentricTriangle.js +459 -11
  58. package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
  59. package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts +1 -0
  60. package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
  61. package/lib/cjs/geometry3d/CoincidentGeometryOps.js +3 -0
  62. package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
  63. package/lib/cjs/geometry3d/GrowableFloat64Array.js +2 -2
  64. package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
  65. package/lib/cjs/geometry3d/GrowableXYArray.d.ts +1 -1
  66. package/lib/cjs/geometry3d/GrowableXYArray.d.ts.map +1 -1
  67. package/lib/cjs/geometry3d/GrowableXYArray.js +2 -2
  68. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  69. package/lib/cjs/geometry3d/GrowableXYZArray.js +1 -1
  70. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  71. package/lib/cjs/geometry3d/IndexedXYCollection.d.ts +22 -7
  72. package/lib/cjs/geometry3d/IndexedXYCollection.d.ts.map +1 -1
  73. package/lib/cjs/geometry3d/IndexedXYCollection.js +41 -5
  74. package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
  75. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +58 -4
  76. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  77. package/lib/cjs/geometry3d/IndexedXYZCollection.js +102 -4
  78. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  79. package/lib/cjs/geometry3d/Matrix3d.d.ts +479 -265
  80. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  81. package/lib/cjs/geometry3d/Matrix3d.js +996 -784
  82. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  83. package/lib/cjs/geometry3d/OrderedRotationAngles.d.ts +1 -0
  84. package/lib/cjs/geometry3d/OrderedRotationAngles.d.ts.map +1 -1
  85. package/lib/cjs/geometry3d/OrderedRotationAngles.js +1 -0
  86. package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
  87. package/lib/cjs/geometry3d/Point2dArrayCarrier.d.ts +10 -0
  88. package/lib/cjs/geometry3d/Point2dArrayCarrier.d.ts.map +1 -1
  89. package/lib/cjs/geometry3d/Point2dArrayCarrier.js +14 -0
  90. package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
  91. package/lib/cjs/geometry3d/Point2dVector2d.js +4 -6
  92. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  93. package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts +0 -6
  94. package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  95. package/lib/cjs/geometry3d/Point3dArrayCarrier.js +0 -6
  96. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  97. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +57 -57
  98. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  99. package/lib/cjs/geometry3d/Point3dVector3d.js +63 -65
  100. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  101. package/lib/cjs/geometry3d/PointHelpers.d.ts +14 -1
  102. package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
  103. package/lib/cjs/geometry3d/PointHelpers.js +33 -1
  104. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  105. package/lib/cjs/geometry3d/PolygonOps.d.ts +127 -19
  106. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  107. package/lib/cjs/geometry3d/PolygonOps.js +420 -22
  108. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  109. package/lib/cjs/geometry3d/Ray3d.js +1 -1
  110. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  111. package/lib/cjs/geometry3d/Segment1d.d.ts +1 -1
  112. package/lib/cjs/geometry3d/Segment1d.js +1 -1
  113. package/lib/cjs/geometry3d/Segment1d.js.map +1 -1
  114. package/lib/cjs/numerics/Polynomials.d.ts +12 -0
  115. package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
  116. package/lib/cjs/numerics/Polynomials.js +14 -0
  117. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  118. package/lib/cjs/polyface/AuxData.js +1 -1
  119. package/lib/cjs/polyface/AuxData.js.map +1 -1
  120. package/lib/cjs/polyface/FacetLocationDetail.d.ts +264 -0
  121. package/lib/cjs/polyface/FacetLocationDetail.d.ts.map +1 -0
  122. package/lib/cjs/polyface/FacetLocationDetail.js +376 -0
  123. package/lib/cjs/polyface/FacetLocationDetail.js.map +1 -0
  124. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts +2 -5
  125. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  126. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +5 -2
  127. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  128. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +24 -14
  129. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  130. package/lib/cjs/polyface/PolyfaceBuilder.js +74 -23
  131. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  132. package/lib/cjs/polyface/PolyfaceClip.js +6 -7
  133. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  134. package/lib/cjs/polyface/PolyfaceData.d.ts +1 -1
  135. package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
  136. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  137. package/lib/cjs/polyface/PolyfaceQuery.d.ts +76 -1
  138. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  139. package/lib/cjs/polyface/PolyfaceQuery.js +123 -3
  140. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  141. package/lib/cjs/polyface/multiclip/OffsetMeshContext.d.ts +202 -0
  142. package/lib/cjs/polyface/multiclip/OffsetMeshContext.d.ts.map +1 -0
  143. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js +1038 -0
  144. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -0
  145. package/lib/cjs/serialization/BGFBReader.js +4 -4
  146. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  147. package/lib/cjs/serialization/GeometrySamples.d.ts +8 -6
  148. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  149. package/lib/cjs/serialization/GeometrySamples.js +26 -19
  150. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  151. package/lib/cjs/serialization/IModelJsonSchema.js +1 -2
  152. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  153. package/lib/cjs/solid/Sphere.d.ts +5 -5
  154. package/lib/cjs/solid/Sphere.js +5 -5
  155. package/lib/cjs/solid/Sphere.js.map +1 -1
  156. package/lib/cjs/solid/SweepContour.d.ts.map +1 -1
  157. package/lib/cjs/solid/SweepContour.js +8 -1
  158. package/lib/cjs/solid/SweepContour.js.map +1 -1
  159. package/lib/cjs/topology/Graph.d.ts +113 -7
  160. package/lib/cjs/topology/Graph.d.ts.map +1 -1
  161. package/lib/cjs/topology/Graph.js +185 -7
  162. package/lib/cjs/topology/Graph.js.map +1 -1
  163. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts +38 -0
  164. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts.map +1 -0
  165. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js +82 -0
  166. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -0
  167. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts +2 -1
  168. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  169. package/lib/cjs/topology/HalfEdgeGraphSearch.js +1 -0
  170. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  171. package/lib/cjs/topology/Triangulation.js +1 -1
  172. package/lib/cjs/topology/Triangulation.js.map +1 -1
  173. package/lib/esm/Geometry.d.ts +56 -16
  174. package/lib/esm/Geometry.d.ts.map +1 -1
  175. package/lib/esm/Geometry.js +86 -29
  176. package/lib/esm/Geometry.js.map +1 -1
  177. package/lib/esm/bspline/BSplineCurveOps.js +4 -5
  178. package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
  179. package/lib/esm/bspline/InterpolationCurve3d.js +7 -10
  180. package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
  181. package/lib/esm/clipping/ClipPrimitive.js +2 -2
  182. package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
  183. package/lib/esm/clipping/ClipUtils.js +4 -4
  184. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  185. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js +2 -2
  186. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  187. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  188. package/lib/esm/curve/CurveChainWithDistanceIndex.js +21 -14
  189. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  190. package/lib/esm/curve/CurveCollection.js +1 -1
  191. package/lib/esm/curve/CurveCollection.js.map +1 -1
  192. package/lib/esm/curve/CurveCurve.d.ts +11 -8
  193. package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
  194. package/lib/esm/curve/CurveCurve.js +16 -12
  195. package/lib/esm/curve/CurveCurve.js.map +1 -1
  196. package/lib/esm/curve/CurveCurveIntersectXY.d.ts +5 -1
  197. package/lib/esm/curve/CurveCurveIntersectXY.d.ts.map +1 -1
  198. package/lib/esm/curve/CurveCurveIntersectXY.js +11 -10
  199. package/lib/esm/curve/CurveCurveIntersectXY.js.map +1 -1
  200. package/lib/esm/curve/Loop.d.ts +2 -2
  201. package/lib/esm/curve/Loop.d.ts.map +1 -1
  202. package/lib/esm/curve/Loop.js +6 -0
  203. package/lib/esm/curve/Loop.js.map +1 -1
  204. package/lib/esm/curve/RegionOps.d.ts +10 -10
  205. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  206. package/lib/esm/curve/RegionOps.js +11 -11
  207. package/lib/esm/curve/RegionOps.js.map +1 -1
  208. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts +2 -1
  209. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  210. package/lib/esm/curve/RegionOpsClassificationSweeps.js +5 -2
  211. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  212. package/lib/esm/curve/StrokeOptions.js +1 -2
  213. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  214. package/lib/esm/curve/spiral/DirectSpiral3d.js +1 -2
  215. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  216. package/lib/esm/curve/spiral/IntegratedSpiral3d.js +1 -2
  217. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  218. package/lib/esm/geometry3d/Angle.d.ts +19 -0
  219. package/lib/esm/geometry3d/Angle.d.ts.map +1 -1
  220. package/lib/esm/geometry3d/Angle.js +39 -0
  221. package/lib/esm/geometry3d/Angle.js.map +1 -1
  222. package/lib/esm/geometry3d/AngleSweep.d.ts +1 -0
  223. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  224. package/lib/esm/geometry3d/AngleSweep.js +1 -0
  225. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  226. package/lib/esm/geometry3d/BarycentricTriangle.d.ts +195 -8
  227. package/lib/esm/geometry3d/BarycentricTriangle.d.ts.map +1 -1
  228. package/lib/esm/geometry3d/BarycentricTriangle.js +459 -12
  229. package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
  230. package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts +1 -0
  231. package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
  232. package/lib/esm/geometry3d/CoincidentGeometryOps.js +3 -0
  233. package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
  234. package/lib/esm/geometry3d/GrowableFloat64Array.js +2 -2
  235. package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
  236. package/lib/esm/geometry3d/GrowableXYArray.d.ts +1 -1
  237. package/lib/esm/geometry3d/GrowableXYArray.d.ts.map +1 -1
  238. package/lib/esm/geometry3d/GrowableXYArray.js +2 -2
  239. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  240. package/lib/esm/geometry3d/GrowableXYZArray.js +1 -1
  241. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  242. package/lib/esm/geometry3d/IndexedXYCollection.d.ts +22 -7
  243. package/lib/esm/geometry3d/IndexedXYCollection.d.ts.map +1 -1
  244. package/lib/esm/geometry3d/IndexedXYCollection.js +41 -5
  245. package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
  246. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +58 -4
  247. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  248. package/lib/esm/geometry3d/IndexedXYZCollection.js +103 -5
  249. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  250. package/lib/esm/geometry3d/Matrix3d.d.ts +479 -265
  251. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  252. package/lib/esm/geometry3d/Matrix3d.js +996 -784
  253. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  254. package/lib/esm/geometry3d/OrderedRotationAngles.d.ts +1 -0
  255. package/lib/esm/geometry3d/OrderedRotationAngles.d.ts.map +1 -1
  256. package/lib/esm/geometry3d/OrderedRotationAngles.js +1 -0
  257. package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
  258. package/lib/esm/geometry3d/Point2dArrayCarrier.d.ts +10 -0
  259. package/lib/esm/geometry3d/Point2dArrayCarrier.d.ts.map +1 -1
  260. package/lib/esm/geometry3d/Point2dArrayCarrier.js +14 -0
  261. package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
  262. package/lib/esm/geometry3d/Point2dVector2d.js +4 -6
  263. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  264. package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts +0 -6
  265. package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  266. package/lib/esm/geometry3d/Point3dArrayCarrier.js +0 -6
  267. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  268. package/lib/esm/geometry3d/Point3dVector3d.d.ts +57 -57
  269. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  270. package/lib/esm/geometry3d/Point3dVector3d.js +63 -65
  271. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  272. package/lib/esm/geometry3d/PointHelpers.d.ts +14 -1
  273. package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
  274. package/lib/esm/geometry3d/PointHelpers.js +33 -1
  275. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  276. package/lib/esm/geometry3d/PolygonOps.d.ts +127 -19
  277. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  278. package/lib/esm/geometry3d/PolygonOps.js +419 -22
  279. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  280. package/lib/esm/geometry3d/Ray3d.js +1 -1
  281. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  282. package/lib/esm/geometry3d/Segment1d.d.ts +1 -1
  283. package/lib/esm/geometry3d/Segment1d.js +1 -1
  284. package/lib/esm/geometry3d/Segment1d.js.map +1 -1
  285. package/lib/esm/numerics/Polynomials.d.ts +12 -0
  286. package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
  287. package/lib/esm/numerics/Polynomials.js +14 -0
  288. package/lib/esm/numerics/Polynomials.js.map +1 -1
  289. package/lib/esm/polyface/AuxData.js +1 -1
  290. package/lib/esm/polyface/AuxData.js.map +1 -1
  291. package/lib/esm/polyface/FacetLocationDetail.d.ts +264 -0
  292. package/lib/esm/polyface/FacetLocationDetail.d.ts.map +1 -0
  293. package/lib/esm/polyface/FacetLocationDetail.js +369 -0
  294. package/lib/esm/polyface/FacetLocationDetail.js.map +1 -0
  295. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts +2 -5
  296. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  297. package/lib/esm/polyface/IndexedPolyfaceVisitor.js +5 -2
  298. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  299. package/lib/esm/polyface/PolyfaceBuilder.d.ts +24 -14
  300. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  301. package/lib/esm/polyface/PolyfaceBuilder.js +74 -23
  302. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  303. package/lib/esm/polyface/PolyfaceClip.js +6 -7
  304. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  305. package/lib/esm/polyface/PolyfaceData.d.ts +1 -1
  306. package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
  307. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  308. package/lib/esm/polyface/PolyfaceQuery.d.ts +76 -1
  309. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  310. package/lib/esm/polyface/PolyfaceQuery.js +121 -2
  311. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  312. package/lib/esm/polyface/multiclip/OffsetMeshContext.d.ts +202 -0
  313. package/lib/esm/polyface/multiclip/OffsetMeshContext.d.ts.map +1 -0
  314. package/lib/esm/polyface/multiclip/OffsetMeshContext.js +1032 -0
  315. package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -0
  316. package/lib/esm/serialization/BGFBReader.js +4 -4
  317. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  318. package/lib/esm/serialization/GeometrySamples.d.ts +8 -6
  319. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  320. package/lib/esm/serialization/GeometrySamples.js +26 -19
  321. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  322. package/lib/esm/serialization/IModelJsonSchema.js +1 -2
  323. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  324. package/lib/esm/solid/Sphere.d.ts +5 -5
  325. package/lib/esm/solid/Sphere.js +5 -5
  326. package/lib/esm/solid/Sphere.js.map +1 -1
  327. package/lib/esm/solid/SweepContour.d.ts.map +1 -1
  328. package/lib/esm/solid/SweepContour.js +8 -1
  329. package/lib/esm/solid/SweepContour.js.map +1 -1
  330. package/lib/esm/topology/Graph.d.ts +113 -7
  331. package/lib/esm/topology/Graph.d.ts.map +1 -1
  332. package/lib/esm/topology/Graph.js +185 -7
  333. package/lib/esm/topology/Graph.js.map +1 -1
  334. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts +38 -0
  335. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts.map +1 -0
  336. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js +78 -0
  337. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -0
  338. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts +2 -1
  339. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  340. package/lib/esm/topology/HalfEdgeGraphSearch.js +1 -0
  341. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  342. package/lib/esm/topology/Triangulation.js +1 -1
  343. package/lib/esm/topology/Triangulation.js.map +1 -1
  344. package/package.json +5 -5
@@ -61,6 +61,7 @@ export declare class OrderedRotationAngles {
61
61
  * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.
62
62
  * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation
63
63
  * matrix multiplication would be zRot*yRot*xRot
64
+ * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/CubeRotationAroundStandardAxes
64
65
  * @param xyzRotationIsClockwise the flags controlling whether direction of x,y,z is clockwise or counterclockwise.
65
66
  * rotation direction of x,y,z: true ---> clockwise - false ---> counterclockwise.
66
67
  * * if xyzRotationIsClockwise is undefined it's set to [false, false, false].
@@ -1 +1 @@
1
- {"version":3,"file":"OrderedRotationAngles.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/OrderedRotationAngles.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,EAAE,SAAS,EAAY,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC;;;;;;;;;;GAUG;AACH,qBAAa,qBAAqB;IAChC,wBAAwB;IACxB,OAAO,CAAC,EAAE,CAAQ;IAClB,wBAAwB;IACxB,OAAO,CAAC,EAAE,CAAQ;IAClB,wBAAwB;IACxB,OAAO,CAAC,EAAE,CAAQ;IAClB,2GAA2G;IAC3G,OAAO,CAAC,MAAM,CAAY;IAC1B,sCAAsC;IACtC,OAAO,CAAC,MAAM,CAAC,uBAAuB,CAAkB;IACxD,kBAAkB;IAClB,OAAO;IAMP,0FAA0F;IAC1F,IAAW,KAAK,IAAI,SAAS,CAE5B;IACD,gFAAgF;IAChF,IAAW,MAAM,IAAI,KAAK,CAEzB;IACD,gFAAgF;IAChF,IAAW,MAAM,IAAI,KAAK,CAEzB;IACD,gFAAgF;IAChF,IAAW,MAAM,IAAI,KAAK,CAEzB;IACD,4EAA4E;IAC5E,IAAW,QAAQ,IAAI,MAAM,CAE5B;IACD,4EAA4E;IAC5E,IAAW,QAAQ,IAAI,MAAM,CAE5B;IACD,4EAA4E;IAC5E,IAAW,QAAQ,IAAI,MAAM,CAE5B;IACD,4EAA4E;IAC5E,IAAW,QAAQ,IAAI,MAAM,CAE5B;IACD,4EAA4E;IAC5E,IAAW,QAAQ,IAAI,MAAM,CAE5B;IACD,4EAA4E;IAC5E,IAAW,QAAQ,IAAI,MAAM,CAE5B;IACD,6EAA6E;IAC7E,WAAkB,qBAAqB,IAAI,OAAO,CAEjD;IACD,WAAkB,qBAAqB,CAA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IAqB9G;;;;;;;;;;;;;;OAcG;WACW,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAChG,sBAAsB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,qBAAqB,GAAG,qBAAqB;IAU9G;;;;;;;;;;;;;;OAcG;WACW,YAAY,CAAC,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAC/F,sBAAsB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,qBAAqB,GAAG,qBAAqB;IAU9G;;;;;;;;SAQK;WACS,kBAAkB,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,qBAAqB,GACjG,qBAAqB,GAAG,SAAS;IAoHnC;;;QAGI;IACG,UAAU,CAAC,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ;CA2D/C"}
@@ -85,6 +85,7 @@ export class OrderedRotationAngles {
85
85
  * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.
86
86
  * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation
87
87
  * matrix multiplication would be zRot*yRot*xRot
88
+ * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/CubeRotationAroundStandardAxes
88
89
  * @param xyzRotationIsClockwise the flags controlling whether direction of x,y,z is clockwise or counterclockwise.
89
90
  * rotation direction of x,y,z: true ---> clockwise - false ---> counterclockwise.
90
91
  * * if xyzRotationIsClockwise is undefined it's set to [false, false, false].
@@ -1 +1 @@
1
- {"version":3,"file":"OrderedRotationAngles.js","sourceRoot":"","sources":["../../../src/geometry3d/OrderedRotationAngles.ts"],"names":[],"mappings":"AAAA;;;+FA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AAI,GAAG,EAAE,EAAE,IAAI,GAAG,IAAI,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,CAC5C,CAAC;SACH;aAAM,IAAI,SAAS,KAAK,SAAS,CAAC,GAAG,EAAE;YACtC,GAAG,CAAC,YAAY,CACd,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,EACrB,IAAI,GAAG,IAAI,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,IAAI,GAAG,EAAE,GAAG,IAAI,EAC3C,IAAI,GAAG,EAAE,GAAG,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE,IAAI,GAAG,IAAI,GAAG,EAAE,CAC5C,CAAC;SACH;aAAM,IAAI,SAAS,KAAK,SAAS,CAAC,GAAG,EAAE;YACtC,GAAG,CAAC,YAAY,CACd,EAAE,GAAG,EAAE,EAAE,IAAI,GAAG,IAAI,GAAG,EAAE,EAAE,IAAI,GAAG,IAAI,GAAG,EAAE,EAC3C,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,EACrB,CAAC,EAAE,GAAG,EAAE,EAAE,IAAI,GAAG,IAAI,GAAG,EAAE,EAAE,IAAI,GAAG,IAAI,GAAG,EAAE,CAC7C,CAAC;SACH;aAAM;YACL,GAAG,CAAC,WAAW,EAAE,CAAC;SACnB;QACD,yEAAyE;QACzE,IAAI,CAAC,qBAAqB,CAAC,qBAAqB;YAC9C,GAAG,CAAC,gBAAgB,EAAE,CAAC;QAEzB,OAAO,GAAG,CAAC;IACb,CAAC;;AA7UD,sCAAsC;AACvB,6CAAuB,GAAY,KAAK,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\nimport { AxisOrder, Geometry } from \"../Geometry\";\r\nimport { Angle } from \"./Angle\";\r\nimport { Matrix3d } from \"./Matrix3d\";\r\n\r\n/* cspell:word cxcz, cxsz, cxcy, cxsy, sxcz, sxsz, sxcy, sxsy, cycz, cysz, sycz, sysz */\r\n\r\n/**\r\n * represents a non-trivial rotation using three simple axis rotation angles and an order in which to apply them.\r\n * * This class accommodates application-specific interpretation of \"multiplying 3 rotation matrices\" with regard to\r\n * * Whether a \"vector\" is a \"row\" or a \"column\"\r\n * * The order in which the X,Y,Z rotations are applied.\r\n * * This class bakes in angle rotation directions via create functions (i.e., createRadians, createDegrees, and\r\n * createAngles) so you can define each of the 3 rotations to be clockwise or counterclockwise. The default\r\n * rotation is counterclockwise.\r\n * * Within the imodel geometry library, the preferred rotation order is encapsulated in `YawPitchRollAngles`.\r\n * @alpha\r\n */\r\nexport class OrderedRotationAngles {\r\n /** rotation around x */\r\n private _x: Angle;\r\n /** rotation around y */\r\n private _y: Angle;\r\n /** rotation around z */\r\n private _z: Angle;\r\n /** rotation order. For example XYZ means to rotate around x axis first, then y axis, and finally Z axis */\r\n private _order: AxisOrder;\r\n /** treat vectors as matrix columns */\r\n private static _sTreatVectorsAsColumns: boolean = false;\r\n /** constructor */\r\n private constructor(x: Angle, y: Angle, z: Angle, axisOrder: AxisOrder) {\r\n this._x = x;\r\n this._y = y;\r\n this._z = z;\r\n this._order = axisOrder;\r\n }\r\n /** (Property accessor) Return the `AxisOrder` controlling matrix multiplication order. */\r\n public get order(): AxisOrder {\r\n return this._order;\r\n }\r\n /** (Property accessor) Return the strongly typed angle of rotation around x. */\r\n public get xAngle(): Angle {\r\n return this._x.clone();\r\n }\r\n /** (Property accessor) Return the strongly typed angle of rotation around y. */\r\n public get yAngle(): Angle {\r\n return this._y.clone();\r\n }\r\n /** (Property accessor) Return the strongly typed angle of rotation around z. */\r\n public get zAngle(): Angle {\r\n return this._z.clone();\r\n }\r\n /** (Property accessor) Return the angle of rotation around x, in degrees */\r\n public get xDegrees(): number {\r\n return this._x.degrees;\r\n }\r\n /** (Property accessor) Return the angle of rotation around y, in degrees */\r\n public get xRadians(): number {\r\n return this._x.radians;\r\n }\r\n /** (Property accessor) Return the angle of rotation around z, in degrees */\r\n public get yDegrees(): number {\r\n return this._y.degrees;\r\n }\r\n /** (Property accessor) Return the angle of rotation around x, in radians */\r\n public get yRadians(): number {\r\n return this._y.radians;\r\n }\r\n /** (Property accessor) Return the angle of rotation around y, in radians */\r\n public get zDegrees(): number {\r\n return this._z.degrees;\r\n }\r\n /** (Property accessor) Return the angle of rotation around z, in radians */\r\n public get zRadians(): number {\r\n return this._z.radians;\r\n }\r\n /** the flag controlling whether vectors are treated as rows or as columns */\r\n public static get treatVectorsAsColumns(): boolean {\r\n return OrderedRotationAngles._sTreatVectorsAsColumns;\r\n }\r\n public static set treatVectorsAsColumns(value: boolean) {\r\n OrderedRotationAngles._sTreatVectorsAsColumns = value;\r\n }\r\n /**\r\n * Create an OrderedRotationAngles from three angles (in radians), an ordering in which to apply them when\r\n * rotating, and a flag triple controlling whether direction of x,y,z is clockwise or counterclockwise.\r\n * @param xRadians rotation around x\r\n * @param yRadians rotation around y\r\n * @param zRadians rotation around z\r\n * @param order left to right order of axis names identifies the order that rotations are applied.\r\n * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.\r\n * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation\r\n * matrix multiplication would be zRot*yRot*xRot\r\n * @param xyzRotationIsClockwise the flags controlling whether direction of x,y,z is clockwise or counterclockwise.\r\n * rotation direction of x,y,z: true ---> clockwise - false ---> counterclockwise.\r\n * * if xyzRotationIsClockwise is undefined it's set to [false, false, false].\r\n * @param result caller-allocated OrderedRotationAngles\r\n */\r\n public static createRadians(xRadians: number, yRadians: number, zRadians: number, order: AxisOrder,\r\n xyzRotationIsClockwise?: [boolean, boolean, boolean], result?: OrderedRotationAngles): OrderedRotationAngles {\r\n if (!xyzRotationIsClockwise) {\r\n xyzRotationIsClockwise = [false, false, false];\r\n }\r\n const xRadian = xyzRotationIsClockwise[0] ? -xRadians : xRadians;\r\n const yRadian = xyzRotationIsClockwise[1] ? -yRadians : yRadians;\r\n const zRadian = xyzRotationIsClockwise[2] ? -zRadians : zRadians;\r\n if (result) {\r\n result._x.setRadians(xRadian);\r\n result._y.setRadians(yRadian);\r\n result._z.setRadians(zRadian);\r\n result._order = order;\r\n return result;\r\n }\r\n return new OrderedRotationAngles(\r\n Angle.createRadians(xRadian),\r\n Angle.createRadians(yRadian),\r\n Angle.createRadians(zRadian),\r\n order\r\n );\r\n }\r\n /**\r\n * Create an OrderedRotationAngles from three angles (in degrees) and an ordering in which to apply\r\n * them when rotating.\r\n * @param xDegrees rotation around x\r\n * @param yDegrees rotation around y\r\n * @param zDegrees rotation around z\r\n * @param order left to right order of axis names identifies the order that rotations are applied.\r\n * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.\r\n * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation\r\n * matrix multiplication would be zRot*yRot*xRot\r\n * @param xyzRotationIsClockwise the flags controlling whether direction of x,y,z is clockwise or counterclockwise.\r\n * rotation direction of x,y,z: true ---> clockwise - false ---> counterclockwise.\r\n * * if xyzRotationIsClockwise is undefined it's set to [false, false, false].\r\n * @param result caller-allocated OrderedRotationAngles\r\n */\r\n public static createDegrees(xDegrees: number, yDegrees: number, zDegrees: number, order: AxisOrder,\r\n xyzRotationIsClockwise?: [boolean, boolean, boolean], result?: OrderedRotationAngles): OrderedRotationAngles {\r\n return OrderedRotationAngles.createRadians(\r\n Angle.degreesToRadians(xDegrees),\r\n Angle.degreesToRadians(yDegrees),\r\n Angle.degreesToRadians(zDegrees),\r\n order,\r\n xyzRotationIsClockwise,\r\n result\r\n );\r\n }\r\n /**\r\n * Create an OrderedRotationAngles from three angles, an ordering in which to apply them when rotating,\r\n * and a flag triple controlling whether direction of x,y,z is clockwise or counterclockwise.\r\n * @param xRotation rotation around x\r\n * @param yRotation rotation around y\r\n * @param zRotation rotation around z\r\n * @param order left to right order of axis names identifies the order that rotations are applied\r\n * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.\r\n * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation\r\n * matrix multiplication would be zRot*yRot*xRot\r\n * @param xyzRotationIsClockwise the flags controlling whether direction of x,y,z is clockwise or counterclockwise.\r\n * rotation direction of x,y,z: true ---> clockwise - false ---> counterclockwise.\r\n * * if xyzRotationIsClockwise is undefined it's set to [false, false, false].\r\n * @param result caller-allocated OrderedRotationAngles\r\n */\r\n public static createAngles(xRotation: Angle, yRotation: Angle, zRotation: Angle, order: AxisOrder,\r\n xyzRotationIsClockwise?: [boolean, boolean, boolean], result?: OrderedRotationAngles): OrderedRotationAngles {\r\n return OrderedRotationAngles.createRadians(\r\n xRotation.radians,\r\n yRotation.radians,\r\n zRotation.radians,\r\n order,\r\n xyzRotationIsClockwise,\r\n result\r\n );\r\n }\r\n /**\r\n * Create an OrderedRotationAngles from a 3x3 rotational matrix, given the ordering of axis rotations\r\n * that the matrix derives from.\r\n * * This function creates an OrderedRotationAngles with default angle rotation directions, i.e.,\r\n * it assumes all x, y, and z rotations are counterclockwise.\r\n * * In the failure case the method's return value is `undefined`.\r\n * * In the failure case, if the optional result was supplied, that result will nonetheless be filled with\r\n * a set of angles.\r\n * */\r\n public static createFromMatrix3d(matrix: Matrix3d, order: AxisOrder, result?: OrderedRotationAngles):\r\n OrderedRotationAngles | undefined {\r\n // treat vector as columns\r\n let m11 = matrix.coffs[0], m12 = matrix.coffs[1], m13 = matrix.coffs[2];\r\n let m21 = matrix.coffs[3], m22 = matrix.coffs[4], m23 = matrix.coffs[5];\r\n let m31 = matrix.coffs[6], m32 = matrix.coffs[7], m33 = matrix.coffs[8];\r\n // treat vector as rows\r\n if (!OrderedRotationAngles.treatVectorsAsColumns) {\r\n m11 = matrix.coffs[0], m12 = matrix.coffs[3], m13 = matrix.coffs[6];\r\n m21 = matrix.coffs[1], m22 = matrix.coffs[4], m23 = matrix.coffs[7];\r\n m31 = matrix.coffs[2], m32 = matrix.coffs[5], m33 = matrix.coffs[8];\r\n }\r\n\r\n let xRad: number;\r\n let yRad: number;\r\n let zRad: number;\r\n\r\n switch (order) {\r\n case AxisOrder.XYZ: {\r\n yRad = Math.asin(Math.max(-1, Math.min(1, -m31))); // limit asin domain to [-1,1]\r\n\r\n if (Math.abs(m31) < 0.99999) {\r\n xRad = Math.atan2(m32, m33);\r\n zRad = Math.atan2(m21, m11);\r\n } else {\r\n /**\r\n * If Math.abs(m31) = 1 then yRad = +-90 degrees and therefore, we have a gimbal lock.\r\n * This means xRad and zRad can be anything as long as their sum xRad + zRad is constant.\r\n * so we can pick zRad = 0 and calculate xRad (or pick xRad = 0 and calculate zRad).\r\n * Therefore, rotation matrix becomes\r\n * Matrix3d.createRowValues(\r\n * 0, +-sx, +-cx,\r\n * 0, cx, -sx,\r\n * -+1, 0, 0\r\n * );\r\n * Math details can be found\r\n * https://en.wikipedia.org/wiki/Gimbal_lock#Loss_of_a_degree_of_freedom_with_Euler_angles\r\n */\r\n xRad = Math.atan2(-m23, m22);\r\n zRad = 0;\r\n }\r\n break;\r\n } case AxisOrder.YXZ: {\r\n xRad = Math.asin(Math.max(-1, Math.min(1, m32))); // limit asin domain to [-1,1]\r\n\r\n if (Math.abs(m32) < 0.99999) {\r\n yRad = Math.atan2(-m31, m33);\r\n zRad = Math.atan2(-m12, m22);\r\n } else {\r\n yRad = Math.atan2(m13, m11);\r\n zRad = 0;\r\n }\r\n break;\r\n } case AxisOrder.ZXY: {\r\n xRad = Math.asin(Math.max(-1, Math.min(1, -m23))); // limit asin domain to [-1,1]\r\n\r\n if (Math.abs(m23) < 0.99999) {\r\n yRad = Math.atan2(m13, m33);\r\n zRad = Math.atan2(m21, m22);\r\n } else {\r\n yRad = 0;\r\n zRad = Math.atan2(-m12, m11);\r\n }\r\n break;\r\n } case AxisOrder.ZYX: {\r\n yRad = Math.asin(Math.max(-1, Math.min(1, m13))); // limit asin domain to [-1,1]\r\n\r\n if (Math.abs(m13) < 0.99999) {\r\n xRad = Math.atan2(-m23, m33);\r\n zRad = Math.atan2(-m12, m11);\r\n } else {\r\n xRad = 0;\r\n zRad = Math.atan2(m21, m22);\r\n }\r\n break;\r\n } case AxisOrder.YZX: {\r\n zRad = Math.asin(Math.max(-1, Math.min(1, -m12))); // limit asin domain to [-1,1]\r\n\r\n if (Math.abs(m12) < 0.99999) {\r\n xRad = Math.atan2(m32, m22);\r\n yRad = Math.atan2(m13, m11);\r\n } else {\r\n xRad = 0;\r\n yRad = Math.atan2(-m31, m33);\r\n }\r\n break;\r\n } case AxisOrder.XZY: {\r\n zRad = Math.asin(Math.max(-1, Math.min(1, m21))); // limit asin domain to [-1,1]\r\n\r\n if (Math.abs(m21) < 0.99999) {\r\n xRad = Math.atan2(-m23, m22);\r\n yRad = Math.atan2(-m31, m11);\r\n } else {\r\n xRad = Math.atan2(m32, m33);\r\n yRad = 0;\r\n }\r\n break;\r\n } default: {\r\n xRad = yRad = zRad = 0;\r\n }\r\n }\r\n const xyzRotationIsClockwise: [boolean, boolean, boolean] = [false, false, false];\r\n const angles = OrderedRotationAngles.createRadians(xRad, yRad, zRad, order, xyzRotationIsClockwise, result);\r\n // sanity check\r\n const matrix1 = angles.toMatrix3d();\r\n /**\r\n * Below tolerance loosened to allow sanity check to pass for\r\n *\r\n * OrderedRotationAngles.createFromMatrix3d(\r\n * OrderedRotationAngles.createDegrees(0, 89.999, 0.001, AxisOrder.XYZ).toMatrix3d(),\r\n * AxisOrder.XYZ\r\n * );\r\n *\r\n * with treatVectorsAsColumns = true.\r\n */\r\n return (matrix.maxDiff(matrix1) < 10 * Geometry.smallFraction) ? angles : undefined;\r\n }\r\n /**\r\n * Create a 3x3 rotational matrix from this OrderedRotationAngles.\r\n ** math details can be found at docs/learning/geometry/Angle.md\r\n **/\r\n public toMatrix3d(result?: Matrix3d): Matrix3d {\r\n const rot = (result !== undefined) ? result : new Matrix3d();\r\n const axisOrder = this.order;\r\n const x = this.xAngle, y = this.yAngle, z = this.zAngle;\r\n\r\n const cx = x.cos(), sx = x.sin();\r\n const cy = y.cos(), sy = y.sin();\r\n const cz = z.cos(), sz = z.sin();\r\n\r\n const cxcz = cx * cz, cxsz = cx * sz, cxcy = cx * cy, cxsy = cx * sy;\r\n const sxcz = sx * cz, sxsz = sx * sz, sxcy = sx * cy, sxsy = sx * sy;\r\n const cycz = cy * cz, cysz = cy * sz, sycz = sy * cz, sysz = sy * sz;\r\n\r\n // the rotation matrix we build below is created using column-based base rotation matrixes\r\n if (axisOrder === AxisOrder.XYZ) {\r\n rot.setRowValues(\r\n cy * cz, sxcz * sy - cxsz, cxcz * sy + sxsz,\r\n cy * sz, cxcz + sxsz * sy, cxsz * sy - sxcz,\r\n -sy, sx * cy, cx * cy,\r\n );\r\n } else if (axisOrder === AxisOrder.YXZ) {\r\n rot.setRowValues(\r\n cycz - sysz * sx, -cx * sz, cysz * sx + sycz,\r\n sycz * sx + cysz, cx * cz, sysz - cycz * sx,\r\n -cx * sy, sx, cx * cy,\r\n );\r\n } else if (axisOrder === AxisOrder.ZXY) {\r\n rot.setRowValues(\r\n cycz + sysz * sx, sycz * sx - cysz, cx * sy,\r\n cx * sz, cx * cz, -sx,\r\n cysz * sx - sycz, cycz * sx + sysz, cx * cy,\r\n );\r\n } else if (axisOrder === AxisOrder.ZYX) {\r\n rot.setRowValues(\r\n cy * cz, -cy * sz, sy,\r\n sxcz * sy + cxsz, cxcz - sxsz * sy, -sx * cy,\r\n sxsz - cxcz * sy, sxcz + cxsz * sy, cx * cy,\r\n );\r\n } else if (axisOrder === AxisOrder.YZX) {\r\n rot.setRowValues(\r\n cy * cz, -sz, sy * cz,\r\n sxsy + cxcy * sz, cx * cz, cxsy * sz - sxcy,\r\n sxcy * sz - cxsy, sx * cz, cxcy + sxsy * sz,\r\n );\r\n } else if (axisOrder === AxisOrder.XZY) {\r\n rot.setRowValues(\r\n cy * cz, sxsy - cxcy * sz, cxsy + sxcy * sz,\r\n sz, cx * cz, -sx * cz,\r\n -sy * cz, sxcy + cxsy * sz, cxcy - sxsy * sz,\r\n );\r\n } else {\r\n rot.setIdentity();\r\n }\r\n // if we need row-based rotation matrix, we transpose the rotation matrix\r\n if (!OrderedRotationAngles.treatVectorsAsColumns)\r\n rot.transposeInPlace();\r\n\r\n return rot;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"OrderedRotationAngles.js","sourceRoot":"","sources":["../../../src/geometry3d/OrderedRotationAngles.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,wFAAwF;AAExF;;;;;;;;;;GAUG;AACH,MAAM,OAAO,qBAAqB;IAWhC,kBAAkB;IAClB,YAAoB,CAAQ,EAAE,CAAQ,EAAE,CAAQ,EAAE,SAAoB;QACpE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QACZ,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QACZ,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QACZ,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;IAC1B,CAAC;IACD,0FAA0F;IAC1F,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IACD,gFAAgF;IAChF,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;IACD,gFAAgF;IAChF,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;IACD,gFAAgF;IAChF,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;IACD,4EAA4E;IAC5E,IAAW,QAAQ;QACjB,OAAO,I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,CAAC,gBAAgB,EAAE,CAAC;QAEzB,OAAO,GAAG,CAAC;IACb,CAAC;;AA9UD,sCAAsC;AACvB,6CAAuB,GAAY,KAAK,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\nimport { AxisOrder, Geometry } from \"../Geometry\";\r\nimport { Angle } from \"./Angle\";\r\nimport { Matrix3d } from \"./Matrix3d\";\r\n\r\n/* cspell:word cxcz, cxsz, cxcy, cxsy, sxcz, sxsz, sxcy, sxsy, cycz, cysz, sycz, sysz */\r\n\r\n/**\r\n * represents a non-trivial rotation using three simple axis rotation angles and an order in which to apply them.\r\n * * This class accommodates application-specific interpretation of \"multiplying 3 rotation matrices\" with regard to\r\n * * Whether a \"vector\" is a \"row\" or a \"column\"\r\n * * The order in which the X,Y,Z rotations are applied.\r\n * * This class bakes in angle rotation directions via create functions (i.e., createRadians, createDegrees, and\r\n * createAngles) so you can define each of the 3 rotations to be clockwise or counterclockwise. The default\r\n * rotation is counterclockwise.\r\n * * Within the imodel geometry library, the preferred rotation order is encapsulated in `YawPitchRollAngles`.\r\n * @alpha\r\n */\r\nexport class OrderedRotationAngles {\r\n /** rotation around x */\r\n private _x: Angle;\r\n /** rotation around y */\r\n private _y: Angle;\r\n /** rotation around z */\r\n private _z: Angle;\r\n /** rotation order. For example XYZ means to rotate around x axis first, then y axis, and finally Z axis */\r\n private _order: AxisOrder;\r\n /** treat vectors as matrix columns */\r\n private static _sTreatVectorsAsColumns: boolean = false;\r\n /** constructor */\r\n private constructor(x: Angle, y: Angle, z: Angle, axisOrder: AxisOrder) {\r\n this._x = x;\r\n this._y = y;\r\n this._z = z;\r\n this._order = axisOrder;\r\n }\r\n /** (Property accessor) Return the `AxisOrder` controlling matrix multiplication order. */\r\n public get order(): AxisOrder {\r\n return this._order;\r\n }\r\n /** (Property accessor) Return the strongly typed angle of rotation around x. */\r\n public get xAngle(): Angle {\r\n return this._x.clone();\r\n }\r\n /** (Property accessor) Return the strongly typed angle of rotation around y. */\r\n public get yAngle(): Angle {\r\n return this._y.clone();\r\n }\r\n /** (Property accessor) Return the strongly typed angle of rotation around z. */\r\n public get zAngle(): Angle {\r\n return this._z.clone();\r\n }\r\n /** (Property accessor) Return the angle of rotation around x, in degrees */\r\n public get xDegrees(): number {\r\n return this._x.degrees;\r\n }\r\n /** (Property accessor) Return the angle of rotation around y, in degrees */\r\n public get xRadians(): number {\r\n return this._x.radians;\r\n }\r\n /** (Property accessor) Return the angle of rotation around z, in degrees */\r\n public get yDegrees(): number {\r\n return this._y.degrees;\r\n }\r\n /** (Property accessor) Return the angle of rotation around x, in radians */\r\n public get yRadians(): number {\r\n return this._y.radians;\r\n }\r\n /** (Property accessor) Return the angle of rotation around y, in radians */\r\n public get zDegrees(): number {\r\n return this._z.degrees;\r\n }\r\n /** (Property accessor) Return the angle of rotation around z, in radians */\r\n public get zRadians(): number {\r\n return this._z.radians;\r\n }\r\n /** the flag controlling whether vectors are treated as rows or as columns */\r\n public static get treatVectorsAsColumns(): boolean {\r\n return OrderedRotationAngles._sTreatVectorsAsColumns;\r\n }\r\n public static set treatVectorsAsColumns(value: boolean) {\r\n OrderedRotationAngles._sTreatVectorsAsColumns = value;\r\n }\r\n /**\r\n * Create an OrderedRotationAngles from three angles (in radians), an ordering in which to apply them when\r\n * rotating, and a flag triple controlling whether direction of x,y,z is clockwise or counterclockwise.\r\n * @param xRadians rotation around x\r\n * @param yRadians rotation around y\r\n * @param zRadians rotation around z\r\n * @param order left to right order of axis names identifies the order that rotations are applied.\r\n * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.\r\n * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation\r\n * matrix multiplication would be zRot*yRot*xRot\r\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/CubeRotationAroundStandardAxes\r\n * @param xyzRotationIsClockwise the flags controlling whether direction of x,y,z is clockwise or counterclockwise.\r\n * rotation direction of x,y,z: true ---> clockwise - false ---> counterclockwise.\r\n * * if xyzRotationIsClockwise is undefined it's set to [false, false, false].\r\n * @param result caller-allocated OrderedRotationAngles\r\n */\r\n public static createRadians(xRadians: number, yRadians: number, zRadians: number, order: AxisOrder,\r\n xyzRotationIsClockwise?: [boolean, boolean, boolean], result?: OrderedRotationAngles): OrderedRotationAngles {\r\n if (!xyzRotationIsClockwise) {\r\n xyzRotationIsClockwise = [false, false, false];\r\n }\r\n const xRadian = xyzRotationIsClockwise[0] ? -xRadians : xRadians;\r\n const yRadian = xyzRotationIsClockwise[1] ? -yRadians : yRadians;\r\n const zRadian = xyzRotationIsClockwise[2] ? -zRadians : zRadians;\r\n if (result) {\r\n result._x.setRadians(xRadian);\r\n result._y.setRadians(yRadian);\r\n result._z.setRadians(zRadian);\r\n result._order = order;\r\n return result;\r\n }\r\n return new OrderedRotationAngles(\r\n Angle.createRadians(xRadian),\r\n Angle.createRadians(yRadian),\r\n Angle.createRadians(zRadian),\r\n order\r\n );\r\n }\r\n /**\r\n * Create an OrderedRotationAngles from three angles (in degrees) and an ordering in which to apply\r\n * them when rotating.\r\n * @param xDegrees rotation around x\r\n * @param yDegrees rotation around y\r\n * @param zDegrees rotation around z\r\n * @param order left to right order of axis names identifies the order that rotations are applied.\r\n * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.\r\n * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation\r\n * matrix multiplication would be zRot*yRot*xRot\r\n * @param xyzRotationIsClockwise the flags controlling whether direction of x,y,z is clockwise or counterclockwise.\r\n * rotation direction of x,y,z: true ---> clockwise - false ---> counterclockwise.\r\n * * if xyzRotationIsClockwise is undefined it's set to [false, false, false].\r\n * @param result caller-allocated OrderedRotationAngles\r\n */\r\n public static createDegrees(xDegrees: number, yDegrees: number, zDegrees: number, order: AxisOrder,\r\n xyzRotationIsClockwise?: [boolean, boolean, boolean], result?: OrderedRotationAngles): OrderedRotationAngles {\r\n return OrderedRotationAngles.createRadians(\r\n Angle.degreesToRadians(xDegrees),\r\n Angle.degreesToRadians(yDegrees),\r\n Angle.degreesToRadians(zDegrees),\r\n order,\r\n xyzRotationIsClockwise,\r\n result\r\n );\r\n }\r\n /**\r\n * Create an OrderedRotationAngles from three angles, an ordering in which to apply them when rotating,\r\n * and a flag triple controlling whether direction of x,y,z is clockwise or counterclockwise.\r\n * @param xRotation rotation around x\r\n * @param yRotation rotation around y\r\n * @param zRotation rotation around z\r\n * @param order left to right order of axis names identifies the order that rotations are applied\r\n * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.\r\n * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation\r\n * matrix multiplication would be zRot*yRot*xRot\r\n * @param xyzRotationIsClockwise the flags controlling whether direction of x,y,z is clockwise or counterclockwise.\r\n * rotation direction of x,y,z: true ---> clockwise - false ---> counterclockwise.\r\n * * if xyzRotationIsClockwise is undefined it's set to [false, false, false].\r\n * @param result caller-allocated OrderedRotationAngles\r\n */\r\n public static createAngles(xRotation: Angle, yRotation: Angle, zRotation: Angle, order: AxisOrder,\r\n xyzRotationIsClockwise?: [boolean, boolean, boolean], result?: OrderedRotationAngles): OrderedRotationAngles {\r\n return OrderedRotationAngles.createRadians(\r\n xRotation.radians,\r\n yRotation.radians,\r\n zRotation.radians,\r\n order,\r\n xyzRotationIsClockwise,\r\n result\r\n );\r\n }\r\n /**\r\n * Create an OrderedRotationAngles from a 3x3 rotational matrix, given the ordering of axis rotations\r\n * that the matrix derives from.\r\n * * This function creates an OrderedRotationAngles with default angle rotation directions, i.e.,\r\n * it assumes all x, y, and z rotations are counterclockwise.\r\n * * In the failure case the method's return value is `undefined`.\r\n * * In the failure case, if the optional result was supplied, that result will nonetheless be filled with\r\n * a set of angles.\r\n * */\r\n public static createFromMatrix3d(matrix: Matrix3d, order: AxisOrder, result?: OrderedRotationAngles):\r\n OrderedRotationAngles | undefined {\r\n // treat vector as columns\r\n let m11 = matrix.coffs[0], m12 = matrix.coffs[1], m13 = matrix.coffs[2];\r\n let m21 = matrix.coffs[3], m22 = matrix.coffs[4], m23 = matrix.coffs[5];\r\n let m31 = matrix.coffs[6], m32 = matrix.coffs[7], m33 = matrix.coffs[8];\r\n // treat vector as rows\r\n if (!OrderedRotationAngles.treatVectorsAsColumns) {\r\n m11 = matrix.coffs[0], m12 = matrix.coffs[3], m13 = matrix.coffs[6];\r\n m21 = matrix.coffs[1], m22 = matrix.coffs[4], m23 = matrix.coffs[7];\r\n m31 = matrix.coffs[2], m32 = matrix.coffs[5], m33 = matrix.coffs[8];\r\n }\r\n\r\n let xRad: number;\r\n let yRad: number;\r\n let zRad: number;\r\n\r\n switch (order) {\r\n case AxisOrder.XYZ: {\r\n yRad = Math.asin(Math.max(-1, Math.min(1, -m31))); // limit asin domain to [-1,1]\r\n\r\n if (Math.abs(m31) < 0.99999) {\r\n xRad = Math.atan2(m32, m33);\r\n zRad = Math.atan2(m21, m11);\r\n } else {\r\n /**\r\n * If Math.abs(m31) = 1 then yRad = +-90 degrees and therefore, we have a gimbal lock.\r\n * This means xRad and zRad can be anything as long as their sum xRad + zRad is constant.\r\n * so we can pick zRad = 0 and calculate xRad (or pick xRad = 0 and calculate zRad).\r\n * Therefore, rotation matrix becomes\r\n * Matrix3d.createRowValues(\r\n * 0, +-sx, +-cx,\r\n * 0, cx, -sx,\r\n * -+1, 0, 0\r\n * );\r\n * Math details can be found\r\n * https://en.wikipedia.org/wiki/Gimbal_lock#Loss_of_a_degree_of_freedom_with_Euler_angles\r\n */\r\n xRad = Math.atan2(-m23, m22);\r\n zRad = 0;\r\n }\r\n break;\r\n } case AxisOrder.YXZ: {\r\n xRad = Math.asin(Math.max(-1, Math.min(1, m32))); // limit asin domain to [-1,1]\r\n\r\n if (Math.abs(m32) < 0.99999) {\r\n yRad = Math.atan2(-m31, m33);\r\n zRad = Math.atan2(-m12, m22);\r\n } else {\r\n yRad = Math.atan2(m13, m11);\r\n zRad = 0;\r\n }\r\n break;\r\n } case AxisOrder.ZXY: {\r\n xRad = Math.asin(Math.max(-1, Math.min(1, -m23))); // limit asin domain to [-1,1]\r\n\r\n if (Math.abs(m23) < 0.99999) {\r\n yRad = Math.atan2(m13, m33);\r\n zRad = Math.atan2(m21, m22);\r\n } else {\r\n yRad = 0;\r\n zRad = Math.atan2(-m12, m11);\r\n }\r\n break;\r\n } case AxisOrder.ZYX: {\r\n yRad = Math.asin(Math.max(-1, Math.min(1, m13))); // limit asin domain to [-1,1]\r\n\r\n if (Math.abs(m13) < 0.99999) {\r\n xRad = Math.atan2(-m23, m33);\r\n zRad = Math.atan2(-m12, m11);\r\n } else {\r\n xRad = 0;\r\n zRad = Math.atan2(m21, m22);\r\n }\r\n break;\r\n } case AxisOrder.YZX: {\r\n zRad = Math.asin(Math.max(-1, Math.min(1, -m12))); // limit asin domain to [-1,1]\r\n\r\n if (Math.abs(m12) < 0.99999) {\r\n xRad = Math.atan2(m32, m22);\r\n yRad = Math.atan2(m13, m11);\r\n } else {\r\n xRad = 0;\r\n yRad = Math.atan2(-m31, m33);\r\n }\r\n break;\r\n } case AxisOrder.XZY: {\r\n zRad = Math.asin(Math.max(-1, Math.min(1, m21))); // limit asin domain to [-1,1]\r\n\r\n if (Math.abs(m21) < 0.99999) {\r\n xRad = Math.atan2(-m23, m22);\r\n yRad = Math.atan2(-m31, m11);\r\n } else {\r\n xRad = Math.atan2(m32, m33);\r\n yRad = 0;\r\n }\r\n break;\r\n } default: {\r\n xRad = yRad = zRad = 0;\r\n }\r\n }\r\n const xyzRotationIsClockwise: [boolean, boolean, boolean] = [false, false, false];\r\n const angles = OrderedRotationAngles.createRadians(xRad, yRad, zRad, order, xyzRotationIsClockwise, result);\r\n // sanity check\r\n const matrix1 = angles.toMatrix3d();\r\n /**\r\n * Below tolerance loosened to allow sanity check to pass for\r\n *\r\n * OrderedRotationAngles.createFromMatrix3d(\r\n * OrderedRotationAngles.createDegrees(0, 89.999, 0.001, AxisOrder.XYZ).toMatrix3d(),\r\n * AxisOrder.XYZ\r\n * );\r\n *\r\n * with treatVectorsAsColumns = true.\r\n */\r\n return (matrix.maxDiff(matrix1) < 10 * Geometry.smallFraction) ? angles : undefined;\r\n }\r\n /**\r\n * Create a 3x3 rotational matrix from this OrderedRotationAngles.\r\n ** math details can be found at docs/learning/geometry/Angle.md\r\n **/\r\n public toMatrix3d(result?: Matrix3d): Matrix3d {\r\n const rot = (result !== undefined) ? result : new Matrix3d();\r\n const axisOrder = this.order;\r\n const x = this.xAngle, y = this.yAngle, z = this.zAngle;\r\n\r\n const cx = x.cos(), sx = x.sin();\r\n const cy = y.cos(), sy = y.sin();\r\n const cz = z.cos(), sz = z.sin();\r\n\r\n const cxcz = cx * cz, cxsz = cx * sz, cxcy = cx * cy, cxsy = cx * sy;\r\n const sxcz = sx * cz, sxsz = sx * sz, sxcy = sx * cy, sxsy = sx * sy;\r\n const cycz = cy * cz, cysz = cy * sz, sycz = sy * cz, sysz = sy * sz;\r\n\r\n // the rotation matrix we build below is created using column-based base rotation matrixes\r\n if (axisOrder === AxisOrder.XYZ) {\r\n rot.setRowValues(\r\n cy * cz, sxcz * sy - cxsz, cxcz * sy + sxsz,\r\n cy * sz, cxcz + sxsz * sy, cxsz * sy - sxcz,\r\n -sy, sx * cy, cx * cy,\r\n );\r\n } else if (axisOrder === AxisOrder.YXZ) {\r\n rot.setRowValues(\r\n cycz - sysz * sx, -cx * sz, cysz * sx + sycz,\r\n sycz * sx + cysz, cx * cz, sysz - cycz * sx,\r\n -cx * sy, sx, cx * cy,\r\n );\r\n } else if (axisOrder === AxisOrder.ZXY) {\r\n rot.setRowValues(\r\n cycz + sysz * sx, sycz * sx - cysz, cx * sy,\r\n cx * sz, cx * cz, -sx,\r\n cysz * sx - sycz, cycz * sx + sysz, cx * cy,\r\n );\r\n } else if (axisOrder === AxisOrder.ZYX) {\r\n rot.setRowValues(\r\n cy * cz, -cy * sz, sy,\r\n sxcz * sy + cxsz, cxcz - sxsz * sy, -sx * cy,\r\n sxsz - cxcz * sy, sxcz + cxsz * sy, cx * cy,\r\n );\r\n } else if (axisOrder === AxisOrder.YZX) {\r\n rot.setRowValues(\r\n cy * cz, -sz, sy * cz,\r\n sxsy + cxcy * sz, cx * cz, cxsy * sz - sxcy,\r\n sxcy * sz - cxsy, sx * cz, cxcy + sxsy * sz,\r\n );\r\n } else if (axisOrder === AxisOrder.XZY) {\r\n rot.setRowValues(\r\n cy * cz, sxsy - cxcy * sz, cxsy + sxcy * sz,\r\n sz, cx * cz, -sx * cz,\r\n -sy * cz, sxcy + cxsy * sz, cxcy - sxsy * sz,\r\n );\r\n } else {\r\n rot.setIdentity();\r\n }\r\n // if we need row-based rotation matrix, we transpose the rotation matrix\r\n if (!OrderedRotationAngles.treatVectorsAsColumns)\r\n rot.transposeInPlace();\r\n\r\n return rot;\r\n }\r\n}\r\n"]}
@@ -71,5 +71,15 @@ export declare class Point2dArrayCarrier extends IndexedXYCollection {
71
71
  * read-only property for number of XYZ in the collection.
72
72
  */
73
73
  get length(): number;
74
+ /**
75
+ * Get x coordinate by point index, with no index checking
76
+ * @param pointIndex index to access
77
+ */
78
+ getXAtUncheckedPointIndex(pointIndex: number): number;
79
+ /**
80
+ * Get y coordinate by point index, with no index checking
81
+ * @param pointIndex index to access
82
+ */
83
+ getYAtUncheckedPointIndex(pointIndex: number): number;
74
84
  }
75
85
  //# sourceMappingURL=Point2dArrayCarrier.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Point2dArrayCarrier.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/Point2dArrayCarrier.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAM,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,YA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MAAM;CAGtE"}
@@ -108,5 +108,19 @@ export class Point2dArrayCarrier extends IndexedXYCollection {
108
108
  get length() {
109
109
  return this.data.length;
110
110
  }
111
+ /**
112
+ * Get x coordinate by point index, with no index checking
113
+ * @param pointIndex index to access
114
+ */
115
+ getXAtUncheckedPointIndex(pointIndex) {
116
+ return this.data[pointIndex].x;
117
+ }
118
+ /**
119
+ * Get y coordinate by point index, with no index checking
120
+ * @param pointIndex index to access
121
+ */
122
+ getYAtUncheckedPointIndex(pointIndex) {
123
+ return this.data[pointIndex].y;
124
+ }
111
125
  }
112
126
  //# sourceMappingURL=Point2dArrayCarrier.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Point2dArrayCarrier.js","sourceRoot":"","sources":["../../../src/geometry3d/Point2dArrayCarrier.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,mEAAmE;AAEnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAG1D;;;;;;EAME;AACF,MAAM,OAAO,mBAAoB,SAAQ,mBAAmB;IAG1D,wCAAwC;IACxC,YAAmB,IAAe;QAChC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IACD,8BAA8B;IACvB,YAAY,CAAC,KAAa;QAC/B,OAAO,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;IAChD,CAAC;IACD;;;;;;OAMG;IACI,6BAA6B,CAAC,KAAa,EAAE,MAAgB;QAClE,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE;YAC5B,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAChC,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC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C,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAC/E,OAAO,SAAS,CAAC;IACnB,CAAC;IACD;;;;;;;KAOC;IACM,2BAA2B,CAAC,WAAmB,EAAE,MAAc,EAAE,MAAc;QACpF,IAAI,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC;YAC1F,OAAO,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAC/F,OAAO,SAAS,CAAC;IACnB,CAAC;IACD;;OAEG;IACH,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;IAC1B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\n\r\nimport { IndexedXYCollection } from \"./IndexedXYCollection\";\r\nimport { Point2d, Vector2d, XY } from \"./Point2dVector2d\";\r\nimport { XAndY } from \"./XYZProps\";\r\n\r\n/**\r\n * Helper object to access members of a Point2d[] in geometric calculations.\r\n * * The collection holds only a reference to the actual array.\r\n * * The actual array may be replaced by the user as needed.\r\n * * When replaced, there is no cached data to be updated.\r\n * @public\r\n*/\r\nexport class Point2dArrayCarrier extends IndexedXYCollection {\r\n /** reference to array being queried. */\r\n public data: Point2d[];\r\n /** CAPTURE caller supplied array ... */\r\n public constructor(data: Point2d[]) {\r\n super();\r\n this.data = data;\r\n }\r\n /** test if index is valid */\r\n public isValidIndex(index: number): boolean {\r\n return index >= 0 && index < this.data.length;\r\n }\r\n /**\r\n * Access by index, returning strongly typed Point2d\r\n * * This returns the xy value but NOT reference to the point in the \"carried\" array.\r\n * @param index index of point within the array\r\n * @param result caller-allocated destination\r\n * @returns undefined if the index is out of bounds\r\n */\r\n public getPoint2dAtCheckedPointIndex(index: number, result?: Point2d): Point2d | undefined {\r\n if (this.isValidIndex(index)) {\r\n const source = this.data[index];\r\n return Point2d.create(source.x, source.y, result);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Access by index, returning strongly typed Vector2d\r\n * @param index index of point within the array\r\n * @param result caller-allocated destination\r\n * @returns undefined if the index is out of bounds\r\n */\r\n public getVector2dAtCheckedVectorIndex(index: number, result?: Vector2d): Vector2d | undefined {\r\n if (this.isValidIndex(index)) {\r\n const source = this.data[index];\r\n return Vector2d.create(source.x, source.y, result);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Return a vector from the point at indexA to the point at indexB\r\n * @param indexA index of point within the array\r\n * @param indexB index of point within the array\r\n * @param result caller-allocated vector.\r\n * @returns undefined if either index is out of bounds\r\n */\r\n public vectorIndexIndex(indexA: number, indexB: number, result?: Vector2d): Vector2d | undefined {\r\n if (this.isValidIndex(indexA) && this.isValidIndex(indexB))\r\n return Vector2d.createStartEnd(this.data[indexA], this.data[indexB], result);\r\n return undefined;\r\n }\r\n /**\r\n * Return a vector from given origin to point at indexB\r\n * @param origin origin for vector\r\n * @param indexB index of point within the array\r\n * @param result caller-allocated vector.\r\n * @returns undefined if index is out of bounds\r\n */\r\n public vectorXAndYIndex(origin: XAndY, indexB: number, result?: Vector2d): Vector2d | undefined {\r\n if (this.isValidIndex(indexB))\r\n return Vector2d.createStartEnd(origin, this.data[indexB], result);\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Return the cross product of vectors from origin to points at indexA and indexB\r\n * @param origin origin for vector\r\n * @param indexA index of first target within the array\r\n * @param indexB index of second target within the array\r\n * @param result caller-allocated vector.\r\n * @returns undefined if either index is out of bounds\r\n */\r\n public crossProductXAndYIndexIndex(origin: XAndY, indexA: number, indexB: number): number | undefined {\r\n if (this.isValidIndex(indexA) && this.isValidIndex(indexB))\r\n return XY.crossProductToPoints(origin, this.data[indexA], this.data[indexB]);\r\n return undefined;\r\n }\r\n /**\r\n * Return the cross product of vectors from point at originIndex to points at indexA and indexB\r\n * @param originIndex index of origin\r\n * @param indexA index of first target within the array\r\n * @param indexB index of second target within the array\r\n * @param result caller-allocated vector.\r\n * @returns return true if indexA, indexB both valid\r\n */\r\n public crossProductIndexIndexIndex(originIndex: number, indexA: number, indexB: number): number | undefined {\r\n if (this.isValidIndex(originIndex) && this.isValidIndex(indexA) && this.isValidIndex(indexB))\r\n return XY.crossProductToPoints(this.data[originIndex], this.data[indexA], this.data[indexB]);\r\n return undefined;\r\n }\r\n /**\r\n * read-only property for number of XYZ in the collection.\r\n */\r\n public get length(): number {\r\n return this.data.length;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Point2dArrayCarrier.js","sourceRoot":"","sources":["../../../src/geometry3d/Point2dArrayCarrier.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,mEAAmE;AAEnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAG1D;;;;;;EAME;AACF,MAAM,OAAO,mBAAoB,SAAQ,mBAAmB;IAG1D,wCAAwC;IACxC,YAAmB,IAAe;QAChC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IACD,8BAA8B;IACvB,YAAY,CAAC,KAAa;QAC/B,OAAO,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;IAChD,CAAC;IACD;;;;;;OAMG;IACa,6BAA6B,CAAC,KAAa,EAAE,MAAgB;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E,MAAc,EAAE,MAAc;QACvF,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC;YACxD,OAAO,EAAE,CAAC,oBAAoB,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAC/E,OAAO,SAAS,CAAC;IACnB,CAAC;IACD;;;;;;;KAOC;IACe,2BAA2B,CAAC,WAAmB,EAAE,MAAc,EAAE,MAAc;QAC7F,IAAI,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC;YAC1F,OAAO,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAC/F,OAAO,SAAS,CAAC;IACnB,CAAC;IACD;;OAEG;IACH,IAAoB,MAAM;QACxB,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACa,yBAAyB,CAAC,UAAkB;QAC1D,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC;IAED;;;OAGG;IACa,yBAAyB,CAAC,UAAkB;QAC1D,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\n\r\nimport { IndexedXYCollection } from \"./IndexedXYCollection\";\r\nimport { Point2d, Vector2d, XY } from \"./Point2dVector2d\";\r\nimport { XAndY } from \"./XYZProps\";\r\n\r\n/**\r\n * Helper object to access members of a Point2d[] in geometric calculations.\r\n * * The collection holds only a reference to the actual array.\r\n * * The actual array may be replaced by the user as needed.\r\n * * When replaced, there is no cached data to be updated.\r\n * @public\r\n*/\r\nexport class Point2dArrayCarrier extends IndexedXYCollection {\r\n /** reference to array being queried. */\r\n public data: Point2d[];\r\n /** CAPTURE caller supplied array ... */\r\n public constructor(data: Point2d[]) {\r\n super();\r\n this.data = data;\r\n }\r\n /** test if index is valid */\r\n public isValidIndex(index: number): boolean {\r\n return index >= 0 && index < this.data.length;\r\n }\r\n /**\r\n * Access by index, returning strongly typed Point2d\r\n * * This returns the xy value but NOT reference to the point in the \"carried\" array.\r\n * @param index index of point within the array\r\n * @param result caller-allocated destination\r\n * @returns undefined if the index is out of bounds\r\n */\r\n public override getPoint2dAtCheckedPointIndex(index: number, result?: Point2d): Point2d | undefined {\r\n if (this.isValidIndex(index)) {\r\n const source = this.data[index];\r\n return Point2d.create(source.x, source.y, result);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Access by index, returning strongly typed Vector2d\r\n * @param index index of point within the array\r\n * @param result caller-allocated destination\r\n * @returns undefined if the index is out of bounds\r\n */\r\n public override getVector2dAtCheckedVectorIndex(index: number, result?: Vector2d): Vector2d | undefined {\r\n if (this.isValidIndex(index)) {\r\n const source = this.data[index];\r\n return Vector2d.create(source.x, source.y, result);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Return a vector from the point at indexA to the point at indexB\r\n * @param indexA index of point within the array\r\n * @param indexB index of point within the array\r\n * @param result caller-allocated vector.\r\n * @returns undefined if either index is out of bounds\r\n */\r\n public override vectorIndexIndex(indexA: number, indexB: number, result?: Vector2d): Vector2d | undefined {\r\n if (this.isValidIndex(indexA) && this.isValidIndex(indexB))\r\n return Vector2d.createStartEnd(this.data[indexA], this.data[indexB], result);\r\n return undefined;\r\n }\r\n /**\r\n * Return a vector from given origin to point at indexB\r\n * @param origin origin for vector\r\n * @param indexB index of point within the array\r\n * @param result caller-allocated vector.\r\n * @returns undefined if index is out of bounds\r\n */\r\n public override vectorXAndYIndex(origin: XAndY, indexB: number, result?: Vector2d): Vector2d | undefined {\r\n if (this.isValidIndex(indexB))\r\n return Vector2d.createStartEnd(origin, this.data[indexB], result);\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Return the cross product of vectors from origin to points at indexA and indexB\r\n * @param origin origin for vector\r\n * @param indexA index of first target within the array\r\n * @param indexB index of second target within the array\r\n * @param result caller-allocated vector.\r\n * @returns undefined if either index is out of bounds\r\n */\r\n public override crossProductXAndYIndexIndex(origin: XAndY, indexA: number, indexB: number): number | undefined {\r\n if (this.isValidIndex(indexA) && this.isValidIndex(indexB))\r\n return XY.crossProductToPoints(origin, this.data[indexA], this.data[indexB]);\r\n return undefined;\r\n }\r\n /**\r\n * Return the cross product of vectors from point at originIndex to points at indexA and indexB\r\n * @param originIndex index of origin\r\n * @param indexA index of first target within the array\r\n * @param indexB index of second target within the array\r\n * @param result caller-allocated vector.\r\n * @returns return true if indexA, indexB both valid\r\n */\r\n public override crossProductIndexIndexIndex(originIndex: number, indexA: number, indexB: number): number | undefined {\r\n if (this.isValidIndex(originIndex) && this.isValidIndex(indexA) && this.isValidIndex(indexB))\r\n return XY.crossProductToPoints(this.data[originIndex], this.data[indexA], this.data[indexB]);\r\n return undefined;\r\n }\r\n /**\r\n * read-only property for number of XYZ in the collection.\r\n */\r\n public override get length(): number {\r\n return this.data.length;\r\n }\r\n\r\n /**\r\n * Get x coordinate by point index, with no index checking\r\n * @param pointIndex index to access\r\n */\r\n public override getXAtUncheckedPointIndex(pointIndex: number): number {\r\n return this.data[pointIndex].x;\r\n }\r\n\r\n /**\r\n * Get y coordinate by point index, with no index checking\r\n * @param pointIndex index to access\r\n */\r\n public override getYAtUncheckedPointIndex(pointIndex: number): number {\r\n return this.data[pointIndex].y;\r\n }\r\n}\r\n"]}
@@ -572,9 +572,8 @@ export class Vector2d extends XY {
572
572
  * @param options optional radian and distance tolerances.
573
573
  */
574
574
  isParallelTo(other, oppositeIsParallel = false, returnValueIfAnInputIsZeroLength = false, options) {
575
- var _a, _b;
576
- const radianSquaredTol = (_a = options === null || options === void 0 ? void 0 : options.radianSquaredTol) !== null && _a !== void 0 ? _a : Geometry.smallAngleRadiansSquared;
577
- const distanceSquaredTol = (_b = options === null || options === void 0 ? void 0 : options.distanceSquaredTol) !== null && _b !== void 0 ? _b : Geometry.smallMetricDistanceSquared;
575
+ const radianSquaredTol = options?.radianSquaredTol ?? Geometry.smallAngleRadiansSquared;
576
+ const distanceSquaredTol = options?.distanceSquaredTol ?? Geometry.smallMetricDistanceSquared;
578
577
  const a2 = this.magnitudeSquared();
579
578
  const b2 = other.magnitudeSquared();
580
579
  if (a2 < distanceSquaredTol || b2 < distanceSquaredTol)
@@ -597,9 +596,8 @@ export class Vector2d extends XY {
597
596
  * @param options optional radian and distance tolerances.
598
597
  */
599
598
  isPerpendicularTo(other, returnValueIfAnInputIsZeroLength = false, options) {
600
- var _a, _b;
601
- const radianSquaredTol = (_a = options === null || options === void 0 ? void 0 : options.radianSquaredTol) !== null && _a !== void 0 ? _a : Geometry.smallAngleRadiansSquared;
602
- const distanceSquaredTol = (_b = options === null || options === void 0 ? void 0 : options.distanceSquaredTol) !== null && _b !== void 0 ? _b : Geometry.smallMetricDistanceSquared;
599
+ const radianSquaredTol = options?.radianSquaredTol ?? Geometry.smallAngleRadiansSquared;
600
+ const distanceSquaredTol = options?.distanceSquaredTol ?? Geometry.smallMetricDistanceSquared;
603
601
  const aa = this.magnitudeSquared();
604
602
  const bb = other.magnitudeSquared();
605
603
  if (aa < distanceSquaredTol || bb < distanceSquaredTol)
@@ -1 +1 @@
1
- {"version":3,"file":"Point2dVector2d.js","sourceRoot":"","sources":["../../../src/geometry3d/Point2dVector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BAAgB,GAAW,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,gBAAgB,mCAAI,QAAQ,CAAC,wBAAwB,CAAC;QAChG,MAAM,kBAAkB,GAAW,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,kBAAkB,mCAAI,QAAQ,CAAC,0BAA0B,CAAC;QACtG,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACnC,MAAM,EAAE,GAAG,KAAK,CAAC,gBAAgB,EAAE,CAAC;QACpC,IAAI,EAAE,GAAG,kBAAkB,IAAI,EAAE,GAAG,kBAAkB;YACpD,OAAO,gCAAgC,CAAC;QAC1C,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAClC,OAAO,EAAE,GAAG,EAAE,IAAI,gBAAgB,GAAG,EAAE,GAAG,EAAE,CAAC;IAC/C,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n// cspell:word JSONXY\r\n// cspell:word CWXY\r\n\r\nimport { BeJSONFunctions, Geometry, PerpParallelOptions } from \"../Geometry\";\r\nimport { Angle } from \"./Angle\";\r\nimport { XAndY, XYProps } from \"./XYZProps\";\r\n\r\n/** Minimal object containing x,y and operations that are meaningful without change in both point and vector.\r\n * * `XY` is not instantiable.\r\n * * The derived (instantiable) classes are\r\n * * `Point2d`\r\n * * `Vector2d`\r\n * @public\r\n */\r\nexport class XY implements XAndY {\r\n /** x component */\r\n public x: number;\r\n /** y component */\r\n public y: number;\r\n /** Set both x and y. */\r\n public set(x: number = 0, y: number = 0) {\r\n this.x = x;\r\n this.y = y;\r\n }\r\n /** Set both x and y to zero */\r\n public setZero() {\r\n this.x = 0;\r\n this.y = 0;\r\n }\r\n protected constructor(x: number = 0, y: number = 0) {\r\n this.x = x;\r\n this.y = y;\r\n }\r\n /** Set both x and y from other. */\r\n public setFrom(other?: XAndY) {\r\n if (other) {\r\n this.x = other.x;\r\n this.y = other.y;\r\n } else {\r\n this.x = 0;\r\n this.y = 0;\r\n }\r\n }\r\n /** Freeze this instance so it is read-only */\r\n public freeze(): Readonly<this> {\r\n return Object.freeze(this);\r\n }\r\n /** Returns true if this and other have equal x,y parts within Geometry.smallMetricDistance. */\r\n public isAlmostEqual(other: XAndY, tol?: number): boolean {\r\n return Geometry.isSameCoordinate(this.x, other.x, tol) && Geometry.isSameCoordinate(this.y, other.y, tol);\r\n }\r\n /** Returns true if this and other have equal x,y parts within Geometry.smallMetricDistance. */\r\n public isAlmostEqualXY(x: number, y: number, tol?: number): boolean {\r\n return Geometry.isSameCoordinate(this.x, x, tol) && Geometry.isSameCoordinate(this.y, y, tol);\r\n }\r\n /** return a json array `[x,y]` */\r\n public toJSON(): XYProps {\r\n return [this.x, this.y];\r\n }\r\n /** return a json object `{x: 1, y:2}` */\r\n public toJSONXY(): XYProps {\r\n return { x: this.x, y: this.y };\r\n }\r\n /**\r\n * Set x and y from a JSON input such as `[1,2]` or `{x:1, y:2}`\r\n * * If no JSON input is provided, 0 would be used as default values for x and y.\r\n * @param json the JSON input\r\n * */\r\n public setFromJSON(json?: XYProps): void {\r\n if (Array.isArray(json)) {\r\n this.set(json[0] || 0, json[1] || 0);\r\n return;\r\n }\r\n if (json) {\r\n this.set(json.x || 0, json.y || 0);\r\n return;\r\n }\r\n this.set(0, 0);\r\n }\r\n /** Return the distance from this point to other */\r\n public distance(other: XAndY): number {\r\n const xDist = other.x - this.x;\r\n const yDist = other.y - this.y;\r\n return Math.sqrt(xDist * xDist + yDist * yDist);\r\n }\r\n /** Return squared distance from this point to other */\r\n public distanceSquared(other: XAndY): number {\r\n const xDist = other.x - this.x;\r\n const yDist = other.y - this.y;\r\n return xDist * xDist + yDist * yDist;\r\n }\r\n /** Return the largest absolute distance between corresponding components */\r\n public maxDiff(other: XAndY): number {\r\n return Math.max(Math.abs(this.x - other.x), Math.abs(this.y - other.y));\r\n }\r\n /**\r\n * Return the x,y component corresponding to 0,1.\r\n */\r\n public at(index: number): number {\r\n if (index < 0.5)\r\n return this.x;\r\n return this.y;\r\n }\r\n /**\r\n * Set value at index 0 or 1.\r\n */\r\n public setAt(index: number, value: number): void {\r\n if (index < 0.5)\r\n this.x = value;\r\n else\r\n this.y = value;\r\n }\r\n /** Return the index (0,1) of the x,y component with largest absolute value */\r\n public indexOfMaxAbs(): number {\r\n let index = 0;\r\n const a = Math.abs(this.x);\r\n const b = Math.abs(this.y);\r\n if (b > a) {\r\n index = 1;\r\n }\r\n return index;\r\n }\r\n /** returns true if the x,y components are both small by metric metric tolerance */\r\n public get isAlmostZero(): boolean {\r\n return Geometry.isSmallMetricDistance(this.x) && Geometry.isSmallMetricDistance(this.y);\r\n }\r\n /** Return the largest absolute value of any component */\r\n public maxAbs(): number {\r\n return Math.max(Math.abs(this.x), Math.abs(this.y));\r\n }\r\n /** Return the magnitude of the vector */\r\n public magnitude(): number {\r\n return Math.sqrt(this.x * this.x + this.y * this.y);\r\n }\r\n /** Return the squared magnitude of the vector. */\r\n public magnitudeSquared(): number {\r\n return this.x * this.x + this.y * this.y;\r\n }\r\n /** returns true if the x,y components are exactly equal. */\r\n public isExactEqual(other: XAndY): boolean {\r\n return this.x === other.x && this.y === other.y;\r\n }\r\n /** returns true if x,y match `other` within metric tolerance */\r\n public isAlmostEqualMetric(other: XAndY, distanceTol: number = Geometry.smallMetricDistance): boolean {\r\n return this.maxDiff(other) <= distanceTol;\r\n }\r\n /** Return a (full length) vector from this point to other */\r\n public vectorTo(other: XAndY, result?: Vector2d): Vector2d {\r\n return Vector2d.create(\r\n other.x - this.x,\r\n other.y - this.y,\r\n result);\r\n }\r\n /** Return a unit vector from this point to other */\r\n public unitVectorTo(other: XAndY, result?: Vector2d): Vector2d | undefined {\r\n return this.vectorTo(other, result).normalize(result);\r\n }\r\n /** cross product of vectors from origin to targets */\r\n public static crossProductToPoints(origin: XAndY, targetA: XAndY, targetB: XAndY): number {\r\n return Geometry.crossProductXYXY(\r\n targetA.x - origin.x, targetA.y - origin.y, targetB.x - origin.x, targetB.y - origin.y);\r\n }\r\n}\r\n\r\n/** 2D point with `x`,`y` as properties\r\n * @public\r\n */\r\nexport class Point2d extends XY implements BeJSONFunctions {\r\n /** Constructor for Point2d */\r\n constructor(x: number = 0, y: number = 0) {\r\n super(x, y);\r\n }\r\n /** return a new Point2d with x,y coordinates from this. */\r\n public clone(result?: Point2d): Point2d {\r\n return Point2d.create(this.x, this.y, result);\r\n }\r\n /**\r\n * Return a point (newly created unless result provided) with given x,y coordinates\r\n * @param x x coordinate\r\n * @param y y coordinate\r\n * @param result optional result\r\n */\r\n public static create(x: number = 0, y: number = 0, result?: Point2d): Point2d {\r\n if (result) {\r\n result.x = x;\r\n result.y = y;\r\n return result;\r\n }\r\n return new Point2d(x, y);\r\n }\r\n /**\r\n * Set x and y from a JSON input such as `[1,2]` or `{x:1, y:2}`\r\n * * If no JSON input is provided, 0 would be used as default values for x and y.\r\n * @param json the JSON input\r\n * */\r\n public static fromJSON(json?: XYProps): Point2d {\r\n const val = new Point2d();\r\n val.setFromJSON(json);\r\n return val;\r\n }\r\n /** Create (or optionally reuse) a Point2d from another object with fields x and y */\r\n public static createFrom(xy: XAndY | undefined, result?: Point2d): Point2d {\r\n if (xy)\r\n return Point2d.create(xy.x, xy.y, result);\r\n return Point2d.create(0, 0, result);\r\n }\r\n /** Create a Point2d with both coordinates zero. */\r\n public static createZero(result?: Point2d): Point2d {\r\n return Point2d.create(0, 0, result);\r\n }\r\n /** Starting at this point, move along vector by tangentFraction of the vector length, and then\r\n * to the left by leftFraction of the perpendicular vector length.\r\n * @param tangentFraction distance to move along the vector, as a fraction of vector\r\n * @param leftFraction distance to move perpendicular to the vector, as a fraction of the rotated vector\r\n * @param vector the other vector\r\n */\r\n public addForwardLeft(tangentFraction: number, leftFraction: number, vector: Vector2d): Point2d {\r\n const dx = vector.x;\r\n const dy = vector.y;\r\n return Point2d.create(\r\n this.x + tangentFraction * dx - leftFraction * dy,\r\n this.y + tangentFraction * dy + leftFraction * dx\r\n );\r\n }\r\n /** Interpolate at tangentFraction between this instance and point, and then Move by leftFraction\r\n * along the xy perpendicular of the vector between the points.\r\n */\r\n public forwardLeftInterpolate(tangentFraction: number, leftFraction: number, point: XAndY): Point2d {\r\n const dx = point.x - this.x;\r\n const dy = point.y - this.y;\r\n return Point2d.create(\r\n this.x + tangentFraction * dx - leftFraction * dy,\r\n this.y + tangentFraction * dy + leftFraction * dx\r\n );\r\n }\r\n /** Return a point interpolated between this point and the right param. */\r\n public interpolate(fraction: number, other: XAndY, result?: Point2d): Point2d {\r\n if (fraction <= 0.5)\r\n return Point2d.create(\r\n this.x + fraction * (other.x - this.x),\r\n this.y + fraction * (other.y - this.y),\r\n result\r\n );\r\n const t: number = fraction - 1.0;\r\n return Point2d.create(\r\n other.x + t * (other.x - this.x),\r\n other.y + t * (other.y - this.y),\r\n result\r\n );\r\n }\r\n /** Return a point with independent x,y fractional interpolation. */\r\n public interpolateXY(fractionX: number, fractionY: number, other: XAndY, result?: Point2d): Point2d {\r\n return Point2d.create(\r\n Geometry.interpolate(this.x, fractionX, other.x),\r\n Geometry.interpolate(this.y, fractionY, other.y),\r\n result\r\n );\r\n }\r\n /** Return this point minus vector */\r\n public minus(vector: XAndY, result?: Point2d): Point2d {\r\n return Point2d.create(\r\n this.x - vector.x,\r\n this.y - vector.y,\r\n result\r\n );\r\n }\r\n /** Return point plus vector */\r\n public plus(vector: XAndY, result?: Point2d): Point2d {\r\n return Point2d.create(\r\n this.x + vector.x,\r\n this.y + vector.y,\r\n result\r\n );\r\n }\r\n /** Return point plus vector */\r\n public plusXY(dx: number = 0, dy: number = 0, result?: Point2d): Point2d {\r\n return Point2d.create(\r\n this.x + dx,\r\n this.y + dy, result\r\n );\r\n }\r\n /** Return point + vector * scalar */\r\n public plusScaled(vector: XAndY, scaleFactor: number, result?: Point2d): Point2d {\r\n return Point2d.create(\r\n this.x + vector.x * scaleFactor,\r\n this.y + vector.y * scaleFactor,\r\n result\r\n );\r\n }\r\n /** Return point + vectorA * scalarA + vectorB * scalarB */\r\n public plus2Scaled(vectorA: XAndY, scalarA: number, vectorB: XAndY, scalarB: number, result?: Point2d): Point2d {\r\n return Point2d.create(\r\n this.x + vectorA.x * scalarA + vectorB.x * scalarB,\r\n this.y + vectorA.y * scalarA + vectorB.y * scalarB,\r\n result\r\n );\r\n }\r\n /** Return point + vectorA * scalarA + vectorB * scalarB + vectorC * scalarC */\r\n public plus3Scaled(vectorA: XAndY, scalarA: number, vectorB: XAndY, scalarB: number,\r\n vectorC: XAndY, scalarC: number, result?: Point2d): Point2d {\r\n return Point2d.create(\r\n this.x + vectorA.x * scalarA + vectorB.x * scalarB + vectorC.x * scalarC,\r\n this.y + vectorA.y * scalarA + vectorB.y * scalarB + vectorC.y * scalarC,\r\n result\r\n );\r\n }\r\n /**\r\n * Return the dot product of vector from this to targetA and vector from this to targetB\r\n * @param targetA target of first vector\r\n * @param targetB target of second vector\r\n */\r\n public dotVectorsToTargets(targetA: XAndY, targetB: XAndY): number {\r\n return (targetA.x - this.x) * (targetB.x - this.x) + (targetA.y - this.y) * (targetB.y - this.y);\r\n }\r\n /**\r\n * Returns the (scalar) cross product of vector from this to targetA and vector from this to targetB\r\n * @param target1 target of first vector\r\n * @param target2 target of second vector\r\n */\r\n public crossProductToPoints(target1: XAndY, target2: XAndY): number {\r\n const x1 = target1.x - this.x;\r\n const y1 = target1.y - this.y;\r\n const x2 = target2.x - this.x;\r\n const y2 = target2.y - this.y;\r\n return x1 * y2 - y1 * x2;\r\n }\r\n /** Return the fractional coordinate of the projection of this instance x,y onto the\r\n * line from startPoint to endPoint.\r\n * @param startPoint start point of line\r\n * @param endPoint end point of line\r\n * @param defaultFraction fraction to return if startPoint and endPoint are equal.\r\n */\r\n public fractionOfProjectionToLine(startPoint: Point2d, endPoint: Point2d, defaultFraction: number = 0): number {\r\n const denominator = startPoint.distanceSquared(endPoint);\r\n if (denominator < Geometry.smallMetricDistanceSquared)\r\n return defaultFraction;\r\n const numerator = startPoint.dotVectorsToTargets(endPoint, this);\r\n return numerator / denominator;\r\n }\r\n}\r\n\r\n/** 2D vector with `x`,`y` as properties\r\n * @public\r\n */\r\nexport class Vector2d extends XY implements BeJSONFunctions {\r\n constructor(x: number = 0, y: number = 0) {\r\n super(x, y);\r\n }\r\n /** Return a new Vector2d with the same x,y */\r\n public clone(result?: Vector2d): Vector2d {\r\n return Vector2d.create(this.x, this.y, result);\r\n }\r\n /** Return a new Vector2d with given x and y */\r\n public static create(x: number = 0, y: number = 0, result?: Vector2d): Vector2d {\r\n if (result) {\r\n result.x = x;\r\n result.y = y;\r\n return result;\r\n }\r\n return new Vector2d(x, y);\r\n }\r\n /**\r\n * Return a (new) Vector2d with components scale,0\r\n * If scale is not given default value 1 is used.\r\n */\r\n public static unitX(scale: number = 1): Vector2d {\r\n return new Vector2d(scale, 0);\r\n }\r\n /**\r\n * Return a (new) Vector2d with components 0,scale\r\n * If scale is not given default value 1 is used.\r\n */\r\n public static unitY(scale: number = 1): Vector2d {\r\n return new Vector2d(0, scale);\r\n }\r\n /** Return a Vector2d with components 0,0 */\r\n public static createZero(result?: Vector2d): Vector2d {\r\n return Vector2d.create(0, 0, result);\r\n }\r\n /** copy contents from another Point3d, Point2d, Vector2d, or Vector3d, or leading entries of Float64Array */\r\n public static createFrom(data: XAndY | Float64Array, result?: Vector2d): Vector2d {\r\n if (data instanceof Float64Array) {\r\n if (data.length >= 2)\r\n return Vector2d.create(data[0], data[1]);\r\n if (data.length >= 1)\r\n return Vector2d.create(data[0], 0);\r\n return Vector2d.create(0, 0);\r\n }\r\n return Vector2d.create(data.x, data.y, result);\r\n }\r\n /**\r\n * Set x and y from a JSON input such as `[1,2]` or `{x:1, y:2}`\r\n * * If no JSON input is provided, 0 would be used as default values for x and y.\r\n * @param json the JSON input\r\n * */\r\n public static fromJSON(json?: XYProps): Vector2d {\r\n const val = new Vector2d();\r\n val.setFromJSON(json);\r\n return val;\r\n }\r\n /** Return a new Vector2d from polar coordinates for radius and Angle from x axis */\r\n public static createPolar(r: number, theta: Angle): Vector2d {\r\n return Vector2d.create(r * theta.cos(), r * theta.sin());\r\n }\r\n /** Return a new Vector2d extending from point0 to point1 */\r\n public static createStartEnd(point0: XAndY, point1: XAndY, result?: Vector2d): Vector2d {\r\n return Vector2d.create(point1.x - point0.x, point1.y - point0.y, result);\r\n }\r\n /**\r\n * Return a vector that bisects the angle between two normals and extends to the intersection of two offset lines\r\n * * returns `undefined` if `unitPerpA = -unitPerpB` (i.e., are opposite)\r\n * * math details can be found at docs/learning/geometry/PointVector.md\r\n * @param unitPerpA unit perpendicular to incoming direction\r\n * @param unitPerpB unit perpendicular to outgoing direction\r\n * @param offset offset distance\r\n */\r\n public static createOffsetBisector(unitPerpA: Vector2d, unitPerpB: Vector2d, offset: number): Vector2d | undefined {\r\n let bisector: Vector2d | undefined = unitPerpA.plus(unitPerpB);\r\n bisector = bisector.normalize();\r\n if (bisector) {\r\n const c = bisector.dotProduct(unitPerpA);\r\n bisector.scale(offset, bisector);\r\n return bisector.safeDivideOrNull(c);\r\n }\r\n return undefined;\r\n }\r\n /** Return a (new or optionally reused) vector which is `this` divided by `denominator`\r\n * * return undefined if denominator is zero.\r\n */\r\n public safeDivideOrNull(denominator: number, result?: Vector2d): Vector2d | undefined {\r\n if (denominator !== 0.0) {\r\n return this.scale(1.0 / denominator, result);\r\n }\r\n return undefined;\r\n }\r\n /** Return a unit vector in direction of this instance (undefined if this instance has near zero length) */\r\n public normalize(result?: Vector2d): Vector2d | undefined {\r\n const mag = Geometry.correctSmallMetricDistance(this.magnitude());\r\n result = result ? result : new Vector2d();\r\n return this.safeDivideOrNull(mag, result);\r\n }\r\n /**\r\n * Return fractional projection of target vector onto this\r\n * * It's returning the signed projection magnitude divided by the target magnitude. In other words,\r\n * it's returning the length of the projection as a fraction of the target magnitude.\r\n * @param target the target vector\r\n * @param defaultFraction the returned value in case magnitude square of target vector is very small\r\n * */\r\n public fractionOfProjectionToVector(target: Vector2d, defaultFraction?: number): number {\r\n /*\r\n * projection length is (this.target)/||target||\r\n * but here we return (this.target)/||target||^2\r\n */\r\n const denominator = target.magnitudeSquared();\r\n if (denominator < Geometry.smallMetricDistanceSquared)\r\n return defaultFraction ? defaultFraction : 0;\r\n const numerator = this.dotProduct(target);\r\n return numerator / denominator;\r\n }\r\n /** Return a new vector with components negated from this instance. */\r\n public negate(result?: Vector2d): Vector2d {\r\n result = result ? result : new Vector2d();\r\n result.x = -this.x;\r\n result.y = -this.y;\r\n return result;\r\n }\r\n /** Return a vector same length as this but rotated 90 degrees counter clockwise */\r\n public rotate90CCWXY(result?: Vector2d): Vector2d {\r\n result = result ? result : new Vector2d();\r\n // save x,y to allow aliasing (\"this\" can be passed to the function as \"result\")\r\n const xx: number = this.x;\r\n const yy: number = this.y;\r\n result.x = -yy;\r\n result.y = xx;\r\n return result;\r\n }\r\n /** Return a vector same length as this but rotated 90 degrees clockwise */\r\n public rotate90CWXY(result?: Vector2d): Vector2d {\r\n result = result ? result : new Vector2d();\r\n // save x,y to allow aliasing (\"this\" can be passed to the function as \"result\")\r\n const xx: number = this.x;\r\n const yy: number = this.y;\r\n result.x = yy;\r\n result.y = -xx;\r\n return result;\r\n }\r\n /** Return a unit vector perpendicular to this instance. */\r\n public unitPerpendicularXY(result?: Vector2d): Vector2d {\r\n result = result ? result : new Vector2d();\r\n const xx: number = this.x;\r\n const yy: number = this.y;\r\n // save x,y to allow aliasing (\"this\" can be passed to the function as \"result\")\r\n result.x = -yy;\r\n result.y = xx;\r\n const d2: number = xx * xx + yy * yy;\r\n if (d2 !== 0.0) {\r\n const a = 1.0 / Math.sqrt(d2);\r\n result.x *= a;\r\n result.y *= a;\r\n }\r\n return result;\r\n }\r\n /** return a new Vector2d rotated CCW by given angle */\r\n public rotateXY(angle: Angle, result?: Vector2d): Vector2d {\r\n const s = angle.sin();\r\n const c = angle.cos();\r\n // save x,y to allow aliasing (\"this\" can be passed to the function as \"result\")\r\n const xx: number = this.x;\r\n const yy: number = this.y;\r\n result = result ? result : new Vector2d();\r\n result.x = xx * c - yy * s;\r\n result.y = xx * s + yy * c;\r\n return result;\r\n }\r\n /** Return a vector computed at fractional position between this vector and vectorB\r\n * @param fraction fractional position. 0 is at `this`. 1 is at `vectorB`.\r\n * True fractions are \"between\", negatives are \"before this\", beyond 1 is \"beyond vectorB\".\r\n * @param vectorB second vector\r\n * @param result optional preallocated result.\r\n */\r\n public interpolate(fraction: number, vectorB: Vector2d, result?: Vector2d): Vector2d {\r\n result = result ? result : new Vector2d();\r\n /*\r\n * For best last-bit behavior, if fraction is below 0.5, use this as base point.\r\n * If above 0.5, use vectorB as base point.\r\n */\r\n if (fraction <= 0.5) {\r\n result.x = this.x + fraction * (vectorB.x - this.x);\r\n result.y = this.y + fraction * (vectorB.y - this.y);\r\n } else {\r\n const t: number = fraction - 1.0;\r\n result.x = vectorB.x + t * (vectorB.x - this.x);\r\n result.y = vectorB.y + t * (vectorB.y - this.y);\r\n }\r\n return result;\r\n }\r\n /** return {this + vector}. */\r\n public plus(vector: XAndY, result?: Vector2d): Vector2d {\r\n result = result ? result : new Vector2d();\r\n result.x = this.x + vector.x;\r\n result.y = this.y + vector.y;\r\n return result;\r\n }\r\n /** return {this - vector}. */\r\n public minus(vector: XAndY, result?: Vector2d): Vector2d {\r\n result = result ? result : new Vector2d();\r\n result.x = this.x - vector.x;\r\n result.y = this.y - vector.y;\r\n return result;\r\n }\r\n /** Return {point + vector \\* scalar} */\r\n public plusScaled(vector: XAndY, scaleFactor: number, result?: Vector2d): Vector2d {\r\n result = result ? result : new Vector2d();\r\n result.x = this.x + vector.x * scaleFactor;\r\n result.y = this.y + vector.y * scaleFactor;\r\n return result;\r\n }\r\n /** Return {point + vectorA \\* scalarA + vectorB \\* scalarB} */\r\n public plus2Scaled(vectorA: XAndY, scalarA: number, vectorB: XAndY, scalarB: number, result?: Vector2d): Vector2d {\r\n result = result ? result : new Vector2d();\r\n result.x = this.x + vectorA.x * scalarA + vectorB.x * scalarB;\r\n result.y = this.y + vectorA.y * scalarA + vectorB.y * scalarB;\r\n return result;\r\n }\r\n /** Return {this + vectorA \\* scalarA + vectorB \\* scalarB + vectorC \\* scalarC} */\r\n public plus3Scaled(vectorA: XAndY, scalarA: number, vectorB: XAndY, scalarB: number, vectorC: XAndY, scalarC: number, result?: Vector2d): Vector2d {\r\n result = result ? result : new Vector2d();\r\n result.x = this.x + vectorA.x * scalarA + vectorB.x * scalarB + vectorC.x * scalarC;\r\n result.y = this.y + vectorA.y * scalarA + vectorB.y * scalarB + vectorC.y * scalarC;\r\n return result;\r\n }\r\n /** Return {this * scale} */\r\n public scale(scale: number, result?: Vector2d): Vector2d {\r\n result = result ? result : new Vector2d();\r\n result.x = this.x * scale;\r\n result.y = this.y * scale;\r\n return result;\r\n }\r\n /** return a vector parallel to this but with specified length */\r\n public scaleToLength(length: number, result?: Vector2d): Vector2d | undefined {\r\n const mag = Geometry.correctSmallMetricDistance(this.magnitude());\r\n if (mag === 0)\r\n return undefined;\r\n return this.scale(length / mag, result);\r\n }\r\n /** return the dot product of this with vectorB */\r\n public dotProduct(vectorB: XAndY): number {\r\n return this.x * vectorB.x + this.y * vectorB.y;\r\n }\r\n /** dot product with vector from pointA to pointB */\r\n public dotProductStartEnd(pointA: XAndY, pointB: XAndY): number {\r\n return this.x * (pointB.x - pointA.x) + this.y * (pointB.y - pointA.y);\r\n }\r\n /** vector cross product {this CROSS vectorB} */\r\n public crossProduct(vectorB: XAndY): number {\r\n return this.x * vectorB.y - this.y * vectorB.x;\r\n }\r\n /**\r\n * return the radians (as a simple number, not strongly typed Angle) signed angle from this to vectorB.\r\n * This is positive if the shortest turn is counterclockwise, negative if clockwise.\r\n */\r\n public radiansTo(vectorB: XAndY): number {\r\n return Math.atan2(this.crossProduct(vectorB), this.dotProduct(vectorB));\r\n }\r\n /**\r\n * return the (strongly typed) signed angle from this to vectorB.\r\n * This is positive if the shortest turn is counterclockwise, negative if clockwise.\r\n */\r\n public angleTo(vectorB: XAndY): Angle {\r\n return Angle.createRadians(this.radiansTo(vectorB));\r\n }\r\n /**\r\n * Test if this vector is parallel to other.\r\n * * The input tolerances in `options`, if given, are considered to be squared for efficiency's sake,\r\n * so if you have a distance or angle tolerance t, you should pass in t * t.\r\n * @param other second vector for comparison.\r\n * @param oppositeIsParallel whether to consider diametrically opposed vectors as parallel.\r\n * @param options optional radian and distance tolerances.\r\n */\r\n public isParallelTo(other: Vector2d, oppositeIsParallel: boolean = false,\r\n returnValueIfAnInputIsZeroLength: boolean = false, options?: PerpParallelOptions): boolean {\r\n const radianSquaredTol: number = options?.radianSquaredTol ?? Geometry.smallAngleRadiansSquared;\r\n const distanceSquaredTol: number = options?.distanceSquaredTol ?? Geometry.smallMetricDistanceSquared;\r\n const a2 = this.magnitudeSquared();\r\n const b2 = other.magnitudeSquared();\r\n if (a2 < distanceSquaredTol || b2 < distanceSquaredTol)\r\n return returnValueIfAnInputIsZeroLength;\r\n const dot = this.dotProduct(other);\r\n if (dot < 0.0 && !oppositeIsParallel)\r\n return false;\r\n const cross = this.crossProduct(other);\r\n /* a2,b2,cross2 are squared lengths of respective vectors */\r\n /* cross2 = sin^2(theta) * a2 * b2 */\r\n /* For small theta, sin^2(theta)~~theta^2 */\r\n return cross * cross <= radianSquaredTol * a2 * b2;\r\n }\r\n /**\r\n * Test if this vector is perpendicular to other.\r\n * * The input tolerances in `options`, if given, are considered to be squared for efficiency's sake,\r\n * so if you have a distance or angle tolerance t, you should pass in t * t.\r\n * @param other second vector in comparison.\r\n * @param returnValueIfAnInputIsZeroLength if either vector is near zero length, return this value.\r\n * @param options optional radian and distance tolerances.\r\n */\r\n public isPerpendicularTo(other: Vector2d, returnValueIfAnInputIsZeroLength: boolean = false, options?: PerpParallelOptions): boolean {\r\n const radianSquaredTol: number = options?.radianSquaredTol ?? Geometry.smallAngleRadiansSquared;\r\n const distanceSquaredTol: number = options?.distanceSquaredTol ?? Geometry.smallMetricDistanceSquared;\r\n const aa = this.magnitudeSquared();\r\n const bb = other.magnitudeSquared();\r\n if (aa < distanceSquaredTol || bb < distanceSquaredTol)\r\n return returnValueIfAnInputIsZeroLength;\r\n const ab = this.dotProduct(other);\r\n return ab * ab <= radianSquaredTol * aa * bb;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Point2dVector2d.js","sourceRoot":"","sources":["../../../src/geometry3d/Point2dVector2d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,qBAAqB;AACrB,mBAAmB;AAEnB,OAAO,EAAmB,QAAQ,EAAuB,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC;;;;;;GAMG;AACH,MAAM,OAAO,EAAE;IAeb,YAAsB,IAAY,CAAC,EAAE,IAAY,CAAC;QAChD,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;IAbD,wBAAwB;IACjB,GAAG,CAAC,IAAY,CAAC,EAAE,IAAY,CAAC;QACrC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;IACD,+BAA+B;IACxB,OAAO;QACZ,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;IAKD,mCAAmC;IAC5B,OAAO,CAAC,KAAa;QAC1B,IAAI,KAAK,EAAE;YACT,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;YACjB,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;SAClB;aAAM;YACL,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;YACX,IAAI,CAAC,C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,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACvC,4DAA4D;QAC5D,qCAAqC;QACrC,4CAA4C;QAC5C,OAAO,KAAK,GAAG,KAAK,IAAI,gBAAgB,GAAG,EAAE,GAAG,EAAE,CAAC;IACrD,CAAC;IACD;;;;;;;OAOG;IACI,iBAAiB,CAAC,KAAe,EAAE,mCAA4C,KAAK,EAAE,OAA6B;QACxH,MAAM,gBAAgB,GAAW,OAAO,EAAE,gBAAgB,IAAI,QAAQ,CAAC,wBAAwB,CAAC;QAChG,MAAM,kBAAkB,GAAW,OAAO,EAAE,kBAAkB,IAAI,QAAQ,CAAC,0BAA0B,CAAC;QACtG,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACnC,MAAM,EAAE,GAAG,KAAK,CAAC,gBAAgB,EAAE,CAAC;QACpC,IAAI,EAAE,GAAG,kBAAkB,IAAI,EAAE,GAAG,kBAAkB;YACpD,OAAO,gCAAgC,CAAC;QAC1C,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAClC,OAAO,EAAE,GAAG,EAAE,IAAI,gBAAgB,GAAG,EAAE,GAAG,EAAE,CAAC;IAC/C,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n// cspell:word JSONXY\r\n// cspell:word CWXY\r\n\r\nimport { BeJSONFunctions, Geometry, PerpParallelOptions } from \"../Geometry\";\r\nimport { Angle } from \"./Angle\";\r\nimport { XAndY, XYProps } from \"./XYZProps\";\r\n\r\n/** Minimal object containing x,y and operations that are meaningful without change in both point and vector.\r\n * * `XY` is not instantiable.\r\n * * The derived (instantiable) classes are\r\n * * `Point2d`\r\n * * `Vector2d`\r\n * @public\r\n */\r\nexport class XY implements XAndY {\r\n /** x component */\r\n public x: number;\r\n /** y component */\r\n public y: number;\r\n /** Set both x and y. */\r\n public set(x: number = 0, y: number = 0) {\r\n this.x = x;\r\n this.y = y;\r\n }\r\n /** Set both x and y to zero */\r\n public setZero() {\r\n this.x = 0;\r\n this.y = 0;\r\n }\r\n protected constructor(x: number = 0, y: number = 0) {\r\n this.x = x;\r\n this.y = y;\r\n }\r\n /** Set both x and y from other. */\r\n public setFrom(other?: XAndY) {\r\n if (other) {\r\n this.x = other.x;\r\n this.y = other.y;\r\n } else {\r\n this.x = 0;\r\n this.y = 0;\r\n }\r\n }\r\n /** Freeze this instance so it is read-only */\r\n public freeze(): Readonly<this> {\r\n return Object.freeze(this);\r\n }\r\n /** Returns true if this and other have equal x,y parts within Geometry.smallMetricDistance. */\r\n public isAlmostEqual(other: XAndY, tol?: number): boolean {\r\n return Geometry.isSameCoordinate(this.x, other.x, tol) && Geometry.isSameCoordinate(this.y, other.y, tol);\r\n }\r\n /** Returns true if this and other have equal x,y parts within Geometry.smallMetricDistance. */\r\n public isAlmostEqualXY(x: number, y: number, tol?: number): boolean {\r\n return Geometry.isSameCoordinate(this.x, x, tol) && Geometry.isSameCoordinate(this.y, y, tol);\r\n }\r\n /** return a json array `[x,y]` */\r\n public toJSON(): XYProps {\r\n return [this.x, this.y];\r\n }\r\n /** return a json object `{x: 1, y:2}` */\r\n public toJSONXY(): XYProps {\r\n return { x: this.x, y: this.y };\r\n }\r\n /**\r\n * Set x and y from a JSON input such as `[1,2]` or `{x:1, y:2}`\r\n * * If no JSON input is provided, 0 would be used as default values for x and y.\r\n * @param json the JSON input\r\n * */\r\n public setFromJSON(json?: XYProps): void {\r\n if (Array.isArray(json)) {\r\n this.set(json[0] || 0, json[1] || 0);\r\n return;\r\n }\r\n if (json) {\r\n this.set(json.x || 0, json.y || 0);\r\n return;\r\n }\r\n this.set(0, 0);\r\n }\r\n /** Return the distance from this point to other */\r\n public distance(other: XAndY): number {\r\n const xDist = other.x - this.x;\r\n const yDist = other.y - this.y;\r\n return Math.sqrt(xDist * xDist + yDist * yDist);\r\n }\r\n /** Return squared distance from this point to other */\r\n public distanceSquared(other: XAndY): number {\r\n const xDist = other.x - this.x;\r\n const yDist = other.y - this.y;\r\n return xDist * xDist + yDist * yDist;\r\n }\r\n /** Return the largest absolute distance between corresponding components */\r\n public maxDiff(other: XAndY): number {\r\n return Math.max(Math.abs(this.x - other.x), Math.abs(this.y - other.y));\r\n }\r\n /**\r\n * Return the x,y component corresponding to 0,1.\r\n */\r\n public at(index: number): number {\r\n if (index < 0.5)\r\n return this.x;\r\n return this.y;\r\n }\r\n /**\r\n * Set value at index 0 or 1.\r\n */\r\n public setAt(index: number, value: number): void {\r\n if (index < 0.5)\r\n this.x = value;\r\n else\r\n this.y = value;\r\n }\r\n /** Return the index (0,1) of the x,y component with largest absolute value */\r\n public indexOfMaxAbs(): number {\r\n let index = 0;\r\n const a = Math.abs(this.x);\r\n const b = Math.abs(this.y);\r\n if (b > a) {\r\n index = 1;\r\n }\r\n return index;\r\n }\r\n /** returns true if the x,y components are both small by metric metric tolerance */\r\n public get isAlmostZero(): boolean {\r\n return Geometry.isSmallMetricDistance(this.x) && Geometry.isSmallMetricDistance(this.y);\r\n }\r\n /** Return the largest absolute value of any component */\r\n public maxAbs(): number {\r\n return Math.max(Math.abs(this.x), Math.abs(this.y));\r\n }\r\n /** Return the magnitude of the vector */\r\n public magnitude(): number {\r\n return Math.sqrt(this.x * this.x + this.y * this.y);\r\n }\r\n /** Return the squared magnitude of the vector. */\r\n public magnitudeSquared(): number {\r\n return this.x * this.x + this.y * this.y;\r\n }\r\n /** returns true if the x,y components are exactly equal. */\r\n public isExactEqual(other: XAndY): boolean {\r\n return this.x === other.x && this.y === other.y;\r\n }\r\n /** returns true if x,y match `other` within metric tolerance */\r\n public isAlmostEqualMetric(other: XAndY, distanceTol: number = Geometry.smallMetricDistance): boolean {\r\n return this.maxDiff(other) <= distanceTol;\r\n }\r\n /** Return a (full length) vector from this point to other */\r\n public vectorTo(other: XAndY, result?: Vector2d): Vector2d {\r\n return Vector2d.create(\r\n other.x - this.x,\r\n other.y - this.y,\r\n result);\r\n }\r\n /** Return a unit vector from this point to other */\r\n public unitVectorTo(other: XAndY, result?: Vector2d): Vector2d | undefined {\r\n return this.vectorTo(other, result).normalize(result);\r\n }\r\n /** cross product of vectors from origin to targets */\r\n public static crossProductToPoints(origin: XAndY, targetA: XAndY, targetB: XAndY): number {\r\n return Geometry.crossProductXYXY(\r\n targetA.x - origin.x, targetA.y - origin.y, targetB.x - origin.x, targetB.y - origin.y);\r\n }\r\n}\r\n\r\n/** 2D point with `x`,`y` as properties\r\n * @public\r\n */\r\nexport class Point2d extends XY implements BeJSONFunctions {\r\n /** Constructor for Point2d */\r\n constructor(x: number = 0, y: number = 0) {\r\n super(x, y);\r\n }\r\n /** return a new Point2d with x,y coordinates from this. */\r\n public clone(result?: Point2d): Point2d {\r\n return Point2d.create(this.x, this.y, result);\r\n }\r\n /**\r\n * Return a point (newly created unless result provided) with given x,y coordinates\r\n * @param x x coordinate\r\n * @param y y coordinate\r\n * @param result optional result\r\n */\r\n public static create(x: number = 0, y: number = 0, result?: Point2d): Point2d {\r\n if (result) {\r\n result.x = x;\r\n result.y = y;\r\n return result;\r\n }\r\n return new Point2d(x, y);\r\n }\r\n /**\r\n * Set x and y from a JSON input such as `[1,2]` or `{x:1, y:2}`\r\n * * If no JSON input is provided, 0 would be used as default values for x and y.\r\n * @param json the JSON input\r\n * */\r\n public static fromJSON(json?: XYProps): Point2d {\r\n const val = new Point2d();\r\n val.setFromJSON(json);\r\n return val;\r\n }\r\n /** Create (or optionally reuse) a Point2d from another object with fields x and y */\r\n public static createFrom(xy: XAndY | undefined, result?: Point2d): Point2d {\r\n if (xy)\r\n return Point2d.create(xy.x, xy.y, result);\r\n return Point2d.create(0, 0, result);\r\n }\r\n /** Create a Point2d with both coordinates zero. */\r\n public static createZero(result?: Point2d): Point2d {\r\n return Point2d.create(0, 0, result);\r\n }\r\n /** Starting at this point, move along vector by tangentFraction of the vector length, and then\r\n * to the left by leftFraction of the perpendicular vector length.\r\n * @param tangentFraction distance to move along the vector, as a fraction of vector\r\n * @param leftFraction distance to move perpendicular to the vector, as a fraction of the rotated vector\r\n * @param vector the other vector\r\n */\r\n public addForwardLeft(tangentFraction: number, leftFraction: number, vector: Vector2d): Point2d {\r\n const dx = vector.x;\r\n const dy = vector.y;\r\n return Point2d.create(\r\n this.x + tangentFraction * dx - leftFraction * dy,\r\n this.y + tangentFraction * dy + leftFraction * dx\r\n );\r\n }\r\n /** Interpolate at tangentFraction between this instance and point, and then Move by leftFraction\r\n * along the xy perpendicular of the vector between the points.\r\n */\r\n public forwardLeftInterpolate(tangentFraction: number, leftFraction: number, point: XAndY): Point2d {\r\n const dx = point.x - this.x;\r\n const dy = point.y - this.y;\r\n return Point2d.create(\r\n this.x + tangentFraction * dx - leftFraction * dy,\r\n this.y + tangentFraction * dy + leftFraction * dx\r\n );\r\n }\r\n /** Return a point interpolated between this point and the right param. */\r\n public interpolate(fraction: number, other: XAndY, result?: Point2d): Point2d {\r\n if (fraction <= 0.5)\r\n return Point2d.create(\r\n this.x + fraction * (other.x - this.x),\r\n this.y + fraction * (other.y - this.y),\r\n result\r\n );\r\n const t: number = fraction - 1.0;\r\n return Point2d.create(\r\n other.x + t * (other.x - this.x),\r\n other.y + t * (other.y - this.y),\r\n result\r\n );\r\n }\r\n /** Return a point with independent x,y fractional interpolation. */\r\n public interpolateXY(fractionX: number, fractionY: number, other: XAndY, result?: Point2d): Point2d {\r\n return Point2d.create(\r\n Geometry.interpolate(this.x, fractionX, other.x),\r\n Geometry.interpolate(this.y, fractionY, other.y),\r\n result\r\n );\r\n }\r\n /** Return this point minus vector */\r\n public minus(vector: XAndY, result?: Point2d): Point2d {\r\n return Point2d.create(\r\n this.x - vector.x,\r\n this.y - vector.y,\r\n result\r\n );\r\n }\r\n /** Return point plus vector */\r\n public plus(vector: XAndY, result?: Point2d): Point2d {\r\n return Point2d.create(\r\n this.x + vector.x,\r\n this.y + vector.y,\r\n result\r\n );\r\n }\r\n /** Return point plus vector */\r\n public plusXY(dx: number = 0, dy: number = 0, result?: Point2d): Point2d {\r\n return Point2d.create(\r\n this.x + dx,\r\n this.y + dy, result\r\n );\r\n }\r\n /** Return point + vector * scalar */\r\n public plusScaled(vector: XAndY, scaleFactor: number, result?: Point2d): Point2d {\r\n return Point2d.create(\r\n this.x + vector.x * scaleFactor,\r\n this.y + vector.y * scaleFactor,\r\n result\r\n );\r\n }\r\n /** Return point + vectorA * scalarA + vectorB * scalarB */\r\n public plus2Scaled(vectorA: XAndY, scalarA: number, vectorB: XAndY, scalarB: number, result?: Point2d): Point2d {\r\n return Point2d.create(\r\n this.x + vectorA.x * scalarA + vectorB.x * scalarB,\r\n this.y + vectorA.y * scalarA + vectorB.y * scalarB,\r\n result\r\n );\r\n }\r\n /** Return point + vectorA * scalarA + vectorB * scalarB + vectorC * scalarC */\r\n public plus3Scaled(vectorA: XAndY, scalarA: number, vectorB: XAndY, scalarB: number,\r\n vectorC: XAndY, scalarC: number, result?: Point2d): Point2d {\r\n return Point2d.create(\r\n this.x + vectorA.x * scalarA + vectorB.x * scalarB + vectorC.x * scalarC,\r\n this.y + vectorA.y * scalarA + vectorB.y * scalarB + vectorC.y * scalarC,\r\n result\r\n );\r\n }\r\n /**\r\n * Return the dot product of vector from this to targetA and vector from this to targetB\r\n * @param targetA target of first vector\r\n * @param targetB target of second vector\r\n */\r\n public dotVectorsToTargets(targetA: XAndY, targetB: XAndY): number {\r\n return (targetA.x - this.x) * (targetB.x - this.x) + (targetA.y - this.y) * (targetB.y - this.y);\r\n }\r\n /**\r\n * Returns the (scalar) cross product of vector from this to targetA and vector from this to targetB\r\n * @param target1 target of first vector\r\n * @param target2 target of second vector\r\n */\r\n public crossProductToPoints(target1: XAndY, target2: XAndY): number {\r\n const x1 = target1.x - this.x;\r\n const y1 = target1.y - this.y;\r\n const x2 = target2.x - this.x;\r\n const y2 = target2.y - this.y;\r\n return x1 * y2 - y1 * x2;\r\n }\r\n /** Return the fractional coordinate of the projection of this instance x,y onto the\r\n * line from startPoint to endPoint.\r\n * @param startPoint start point of line\r\n * @param endPoint end point of line\r\n * @param defaultFraction fraction to return if startPoint and endPoint are equal.\r\n */\r\n public fractionOfProjectionToLine(startPoint: Point2d, endPoint: Point2d, defaultFraction: number = 0): number {\r\n const denominator = startPoint.distanceSquared(endPoint);\r\n if (denominator < Geometry.smallMetricDistanceSquared)\r\n return defaultFraction;\r\n const numerator = startPoint.dotVectorsToTargets(endPoint, this);\r\n return numerator / denominator;\r\n }\r\n}\r\n\r\n/** 2D vector with `x`,`y` as properties\r\n * @public\r\n */\r\nexport class Vector2d extends XY implements BeJSONFunctions {\r\n constructor(x: number = 0, y: number = 0) {\r\n super(x, y);\r\n }\r\n /** Return a new Vector2d with the same x,y */\r\n public clone(result?: Vector2d): Vector2d {\r\n return Vector2d.create(this.x, this.y, result);\r\n }\r\n /** Return a new Vector2d with given x and y */\r\n public static create(x: number = 0, y: number = 0, result?: Vector2d): Vector2d {\r\n if (result) {\r\n result.x = x;\r\n result.y = y;\r\n return result;\r\n }\r\n return new Vector2d(x, y);\r\n }\r\n /**\r\n * Return a (new) Vector2d with components scale,0\r\n * If scale is not given default value 1 is used.\r\n */\r\n public static unitX(scale: number = 1): Vector2d {\r\n return new Vector2d(scale, 0);\r\n }\r\n /**\r\n * Return a (new) Vector2d with components 0,scale\r\n * If scale is not given default value 1 is used.\r\n */\r\n public static unitY(scale: number = 1): Vector2d {\r\n return new Vector2d(0, scale);\r\n }\r\n /** Return a Vector2d with components 0,0 */\r\n public static createZero(result?: Vector2d): Vector2d {\r\n return Vector2d.create(0, 0, result);\r\n }\r\n /** copy contents from another Point3d, Point2d, Vector2d, or Vector3d, or leading entries of Float64Array */\r\n public static createFrom(data: XAndY | Float64Array, result?: Vector2d): Vector2d {\r\n if (data instanceof Float64Array) {\r\n if (data.length >= 2)\r\n return Vector2d.create(data[0], data[1]);\r\n if (data.length >= 1)\r\n return Vector2d.create(data[0], 0);\r\n return Vector2d.create(0, 0);\r\n }\r\n return Vector2d.create(data.x, data.y, result);\r\n }\r\n /**\r\n * Set x and y from a JSON input such as `[1,2]` or `{x:1, y:2}`\r\n * * If no JSON input is provided, 0 would be used as default values for x and y.\r\n * @param json the JSON input\r\n * */\r\n public static fromJSON(json?: XYProps): Vector2d {\r\n const val = new Vector2d();\r\n val.setFromJSON(json);\r\n return val;\r\n }\r\n /** Return a new Vector2d from polar coordinates for radius and Angle from x axis */\r\n public static createPolar(r: number, theta: Angle): Vector2d {\r\n return Vector2d.create(r * theta.cos(), r * theta.sin());\r\n }\r\n /** Return a new Vector2d extending from point0 to point1 */\r\n public static createStartEnd(point0: XAndY, point1: XAndY, result?: Vector2d): Vector2d {\r\n return Vector2d.create(point1.x - point0.x, point1.y - point0.y, result);\r\n }\r\n /**\r\n * Return a vector that bisects the angle between two normals and extends to the intersection of two offset lines\r\n * * returns `undefined` if `unitPerpA = -unitPerpB` (i.e., are opposite)\r\n * * math details can be found at docs/learning/geometry/PointVector.md\r\n * @param unitPerpA unit perpendicular to incoming direction\r\n * @param unitPerpB unit perpendicular to outgoing direction\r\n * @param offset offset distance\r\n */\r\n public static createOffsetBisector(unitPerpA: Vector2d, unitPerpB: Vector2d, offset: number): Vector2d | undefined {\r\n let bisector: Vector2d | undefined = unitPerpA.plus(unitPerpB);\r\n bisector = bisector.normalize();\r\n if (bisector) {\r\n const c = bisector.dotProduct(unitPerpA);\r\n bisector.scale(offset, bisector);\r\n return bisector.safeDivideOrNull(c);\r\n }\r\n return undefined;\r\n }\r\n /** Return a (new or optionally reused) vector which is `this` divided by `denominator`\r\n * * return undefined if denominator is zero.\r\n */\r\n public safeDivideOrNull(denominator: number, result?: Vector2d): Vector2d | undefined {\r\n if (denominator !== 0.0) {\r\n return this.scale(1.0 / denominator, result);\r\n }\r\n return undefined;\r\n }\r\n /** Return a unit vector in direction of this instance (undefined if this instance has near zero length) */\r\n public normalize(result?: Vector2d): Vector2d | undefined {\r\n const mag = Geometry.correctSmallMetricDistance(this.magnitude());\r\n result = result ? result : new Vector2d();\r\n return this.safeDivideOrNull(mag, result);\r\n }\r\n /**\r\n * Return fractional projection of target vector onto this\r\n * * It's returning the signed projection magnitude divided by the target magnitude. In other words,\r\n * it's returning the length of the projection as a fraction of the target magnitude.\r\n * @param target the target vector\r\n * @param defaultFraction the returned value in case magnitude square of target vector is very small\r\n * */\r\n public fractionOfProjectionToVector(target: Vector2d, defaultFraction?: number): number {\r\n /*\r\n * projection length is (this.target)/||target||\r\n * but here we return (this.target)/||target||^2\r\n */\r\n const denominator = target.magnitudeSquared();\r\n if (denominator < Geometry.smallMetricDistanceSquared)\r\n return defaultFraction ? defaultFraction : 0;\r\n const numerator = this.dotProduct(target);\r\n return numerator / denominator;\r\n }\r\n /** Return a new vector with components negated from this instance. */\r\n public negate(result?: Vector2d): Vector2d {\r\n result = result ? result : new Vector2d();\r\n result.x = -this.x;\r\n result.y = -this.y;\r\n return result;\r\n }\r\n /** Return a vector same length as this but rotated 90 degrees counter clockwise */\r\n public rotate90CCWXY(result?: Vector2d): Vector2d {\r\n result = result ? result : new Vector2d();\r\n // save x,y to allow aliasing (\"this\" can be passed to the function as \"result\")\r\n const xx: number = this.x;\r\n const yy: number = this.y;\r\n result.x = -yy;\r\n result.y = xx;\r\n return result;\r\n }\r\n /** Return a vector same length as this but rotated 90 degrees clockwise */\r\n public rotate90CWXY(result?: Vector2d): Vector2d {\r\n result = result ? result : new Vector2d();\r\n // save x,y to allow aliasing (\"this\" can be passed to the function as \"result\")\r\n const xx: number = this.x;\r\n const yy: number = this.y;\r\n result.x = yy;\r\n result.y = -xx;\r\n return result;\r\n }\r\n /** Return a unit vector perpendicular to this instance. */\r\n public unitPerpendicularXY(result?: Vector2d): Vector2d {\r\n result = result ? result : new Vector2d();\r\n const xx: number = this.x;\r\n const yy: number = this.y;\r\n // save x,y to allow aliasing (\"this\" can be passed to the function as \"result\")\r\n result.x = -yy;\r\n result.y = xx;\r\n const d2: number = xx * xx + yy * yy;\r\n if (d2 !== 0.0) {\r\n const a = 1.0 / Math.sqrt(d2);\r\n result.x *= a;\r\n result.y *= a;\r\n }\r\n return result;\r\n }\r\n /** return a new Vector2d rotated CCW by given angle */\r\n public rotateXY(angle: Angle, result?: Vector2d): Vector2d {\r\n const s = angle.sin();\r\n const c = angle.cos();\r\n // save x,y to allow aliasing (\"this\" can be passed to the function as \"result\")\r\n const xx: number = this.x;\r\n const yy: number = this.y;\r\n result = result ? result : new Vector2d();\r\n result.x = xx * c - yy * s;\r\n result.y = xx * s + yy * c;\r\n return result;\r\n }\r\n /** Return a vector computed at fractional position between this vector and vectorB\r\n * @param fraction fractional position. 0 is at `this`. 1 is at `vectorB`.\r\n * True fractions are \"between\", negatives are \"before this\", beyond 1 is \"beyond vectorB\".\r\n * @param vectorB second vector\r\n * @param result optional preallocated result.\r\n */\r\n public interpolate(fraction: number, vectorB: Vector2d, result?: Vector2d): Vector2d {\r\n result = result ? result : new Vector2d();\r\n /*\r\n * For best last-bit behavior, if fraction is below 0.5, use this as base point.\r\n * If above 0.5, use vectorB as base point.\r\n */\r\n if (fraction <= 0.5) {\r\n result.x = this.x + fraction * (vectorB.x - this.x);\r\n result.y = this.y + fraction * (vectorB.y - this.y);\r\n } else {\r\n const t: number = fraction - 1.0;\r\n result.x = vectorB.x + t * (vectorB.x - this.x);\r\n result.y = vectorB.y + t * (vectorB.y - this.y);\r\n }\r\n return result;\r\n }\r\n /** return {this + vector}. */\r\n public plus(vector: XAndY, result?: Vector2d): Vector2d {\r\n result = result ? result : new Vector2d();\r\n result.x = this.x + vector.x;\r\n result.y = this.y + vector.y;\r\n return result;\r\n }\r\n /** return {this - vector}. */\r\n public minus(vector: XAndY, result?: Vector2d): Vector2d {\r\n result = result ? result : new Vector2d();\r\n result.x = this.x - vector.x;\r\n result.y = this.y - vector.y;\r\n return result;\r\n }\r\n /** Return {point + vector \\* scalar} */\r\n public plusScaled(vector: XAndY, scaleFactor: number, result?: Vector2d): Vector2d {\r\n result = result ? result : new Vector2d();\r\n result.x = this.x + vector.x * scaleFactor;\r\n result.y = this.y + vector.y * scaleFactor;\r\n return result;\r\n }\r\n /** Return {point + vectorA \\* scalarA + vectorB \\* scalarB} */\r\n public plus2Scaled(vectorA: XAndY, scalarA: number, vectorB: XAndY, scalarB: number, result?: Vector2d): Vector2d {\r\n result = result ? result : new Vector2d();\r\n result.x = this.x + vectorA.x * scalarA + vectorB.x * scalarB;\r\n result.y = this.y + vectorA.y * scalarA + vectorB.y * scalarB;\r\n return result;\r\n }\r\n /** Return {this + vectorA \\* scalarA + vectorB \\* scalarB + vectorC \\* scalarC} */\r\n public plus3Scaled(vectorA: XAndY, scalarA: number, vectorB: XAndY, scalarB: number, vectorC: XAndY, scalarC: number, result?: Vector2d): Vector2d {\r\n result = result ? result : new Vector2d();\r\n result.x = this.x + vectorA.x * scalarA + vectorB.x * scalarB + vectorC.x * scalarC;\r\n result.y = this.y + vectorA.y * scalarA + vectorB.y * scalarB + vectorC.y * scalarC;\r\n return result;\r\n }\r\n /** Return {this * scale} */\r\n public scale(scale: number, result?: Vector2d): Vector2d {\r\n result = result ? result : new Vector2d();\r\n result.x = this.x * scale;\r\n result.y = this.y * scale;\r\n return result;\r\n }\r\n /** return a vector parallel to this but with specified length */\r\n public scaleToLength(length: number, result?: Vector2d): Vector2d | undefined {\r\n const mag = Geometry.correctSmallMetricDistance(this.magnitude());\r\n if (mag === 0)\r\n return undefined;\r\n return this.scale(length / mag, result);\r\n }\r\n /** return the dot product of this with vectorB */\r\n public dotProduct(vectorB: XAndY): number {\r\n return this.x * vectorB.x + this.y * vectorB.y;\r\n }\r\n /** dot product with vector from pointA to pointB */\r\n public dotProductStartEnd(pointA: XAndY, pointB: XAndY): number {\r\n return this.x * (pointB.x - pointA.x) + this.y * (pointB.y - pointA.y);\r\n }\r\n /** vector cross product {this CROSS vectorB} */\r\n public crossProduct(vectorB: XAndY): number {\r\n return this.x * vectorB.y - this.y * vectorB.x;\r\n }\r\n /**\r\n * return the radians (as a simple number, not strongly typed Angle) signed angle from this to vectorB.\r\n * This is positive if the shortest turn is counterclockwise, negative if clockwise.\r\n */\r\n public radiansTo(vectorB: XAndY): number {\r\n return Math.atan2(this.crossProduct(vectorB), this.dotProduct(vectorB));\r\n }\r\n /**\r\n * return the (strongly typed) signed angle from this to vectorB.\r\n * This is positive if the shortest turn is counterclockwise, negative if clockwise.\r\n */\r\n public angleTo(vectorB: XAndY): Angle {\r\n return Angle.createRadians(this.radiansTo(vectorB));\r\n }\r\n /**\r\n * Test if this vector is parallel to other.\r\n * * The input tolerances in `options`, if given, are considered to be squared for efficiency's sake,\r\n * so if you have a distance or angle tolerance t, you should pass in t * t.\r\n * @param other second vector for comparison.\r\n * @param oppositeIsParallel whether to consider diametrically opposed vectors as parallel.\r\n * @param options optional radian and distance tolerances.\r\n */\r\n public isParallelTo(other: Vector2d, oppositeIsParallel: boolean = false,\r\n returnValueIfAnInputIsZeroLength: boolean = false, options?: PerpParallelOptions): boolean {\r\n const radianSquaredTol: number = options?.radianSquaredTol ?? Geometry.smallAngleRadiansSquared;\r\n const distanceSquaredTol: number = options?.distanceSquaredTol ?? Geometry.smallMetricDistanceSquared;\r\n const a2 = this.magnitudeSquared();\r\n const b2 = other.magnitudeSquared();\r\n if (a2 < distanceSquaredTol || b2 < distanceSquaredTol)\r\n return returnValueIfAnInputIsZeroLength;\r\n const dot = this.dotProduct(other);\r\n if (dot < 0.0 && !oppositeIsParallel)\r\n return false;\r\n const cross = this.crossProduct(other);\r\n /* a2,b2,cross2 are squared lengths of respective vectors */\r\n /* cross2 = sin^2(theta) * a2 * b2 */\r\n /* For small theta, sin^2(theta)~~theta^2 */\r\n return cross * cross <= radianSquaredTol * a2 * b2;\r\n }\r\n /**\r\n * Test if this vector is perpendicular to other.\r\n * * The input tolerances in `options`, if given, are considered to be squared for efficiency's sake,\r\n * so if you have a distance or angle tolerance t, you should pass in t * t.\r\n * @param other second vector in comparison.\r\n * @param returnValueIfAnInputIsZeroLength if either vector is near zero length, return this value.\r\n * @param options optional radian and distance tolerances.\r\n */\r\n public isPerpendicularTo(other: Vector2d, returnValueIfAnInputIsZeroLength: boolean = false, options?: PerpParallelOptions): boolean {\r\n const radianSquaredTol: number = options?.radianSquaredTol ?? Geometry.smallAngleRadiansSquared;\r\n const distanceSquaredTol: number = options?.distanceSquaredTol ?? Geometry.smallMetricDistanceSquared;\r\n const aa = this.magnitudeSquared();\r\n const bb = other.magnitudeSquared();\r\n if (aa < distanceSquaredTol || bb < distanceSquaredTol)\r\n return returnValueIfAnInputIsZeroLength;\r\n const ab = this.dotProduct(other);\r\n return ab * ab <= radianSquaredTol * aa * bb;\r\n }\r\n}\r\n"]}
@@ -31,7 +31,6 @@ export declare class Point3dArrayCarrier extends IndexedReadWriteXYZCollection {
31
31
  * * This returns the xyz value but NOT reference to the point in the "carried" array.
32
32
  * @param index index of point within the array
33
33
  * @param result caller-allocated destination
34
- * @returns undefined if the index is out of bounds
35
34
  */
36
35
  getPoint3dAtUncheckedPointIndex(index: number, result?: Point3d): Point3d;
37
36
  /**
@@ -131,19 +130,14 @@ export declare class Point3dArrayCarrier extends IndexedReadWriteXYZCollection {
131
130
  reverseInPlace(): void;
132
131
  /**
133
132
  * Return distance squared between indicated points.
134
- * * Concrete classes may be able to implement this without creating a temporary.
135
133
  * @param index0 first point index
136
134
  * @param index1 second point index
137
- * @param defaultDistanceSquared distance squared to return if either point index is invalid.
138
- *
139
135
  */
140
136
  distanceSquaredIndexIndex(index0: number, index1: number): number | undefined;
141
137
  /**
142
138
  * Return distance between indicated points.
143
- * * Concrete classes may be able to implement this without creating a temporary.
144
139
  * @param index0 first point index
145
140
  * @param index1 second point index
146
- * @param defaultDistanceSquared distance squared to return if either point index is invalid.
147
141
  */
148
142
  distanceIndexIndex(index0: number, index1: number): number | undefined;
149
143
  /** Adjust index into range by modulo with the length. */
@@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,GAAG,OAAO,GAAG,SAAS;IAMnD,8BAA8B;IACvB,GAAG,IAAI,IAAI;IAIlB,yBAAyB;IAClB,KAAK,IAAI,IAAI;IAGpB,kCAAkC;IAC3B,cAAc,IAAI,IAAI;IAG7B;;;;OAIG;IACI,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAOpF;;;;OAIG;IACI,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAO7E,yDAAyD;IACzC,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;CAG/C"}
@@ -43,7 +43,6 @@ export class Point3dArrayCarrier extends IndexedReadWriteXYZCollection {
43
43
  * * This returns the xyz value but NOT reference to the point in the "carried" array.
44
44
  * @param index index of point within the array
45
45
  * @param result caller-allocated destination
46
- * @returns undefined if the index is out of bounds
47
46
  */
48
47
  getPoint3dAtUncheckedPointIndex(index, result) {
49
48
  const source = this.data[index];
@@ -208,11 +207,8 @@ export class Point3dArrayCarrier extends IndexedReadWriteXYZCollection {
208
207
  }
209
208
  /**
210
209
  * Return distance squared between indicated points.
211
- * * Concrete classes may be able to implement this without creating a temporary.
212
210
  * @param index0 first point index
213
211
  * @param index1 second point index
214
- * @param defaultDistanceSquared distance squared to return if either point index is invalid.
215
- *
216
212
  */
217
213
  distanceSquaredIndexIndex(index0, index1) {
218
214
  const n = this.data.length;
@@ -223,10 +219,8 @@ export class Point3dArrayCarrier extends IndexedReadWriteXYZCollection {
223
219
  }
224
220
  /**
225
221
  * Return distance between indicated points.
226
- * * Concrete classes may be able to implement this without creating a temporary.
227
222
  * @param index0 first point index
228
223
  * @param index1 second point index
229
- * @param defaultDistanceSquared distance squared to return if either point index is invalid.
230
224
  */
231
225
  distanceIndexIndex(index0, index1) {
232
226
  const n = this.data.length;