@itwin/core-geometry 4.1.0-dev.6 → 4.1.0-dev.63

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 (310) hide show
  1. package/CHANGELOG.md +62 -1
  2. package/lib/cjs/clipping/ClipPrimitive.d.ts.map +1 -1
  3. package/lib/cjs/clipping/ClipPrimitive.js +2 -0
  4. package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
  5. package/lib/cjs/core-geometry.d.ts +1 -0
  6. package/lib/cjs/core-geometry.d.ts.map +1 -1
  7. package/lib/cjs/core-geometry.js +4 -1
  8. package/lib/cjs/core-geometry.js.map +1 -1
  9. package/lib/cjs/curve/Arc3d.d.ts +1 -0
  10. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  11. package/lib/cjs/curve/Arc3d.js +1 -0
  12. package/lib/cjs/curve/Arc3d.js.map +1 -1
  13. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +61 -41
  14. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  15. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +69 -46
  16. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  17. package/lib/cjs/curve/CurveCollection.d.ts +36 -26
  18. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  19. package/lib/cjs/curve/CurveCollection.js +46 -39
  20. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  21. package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
  22. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  23. package/lib/cjs/curve/CurveFactory.d.ts +67 -3
  24. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  25. package/lib/cjs/curve/CurveFactory.js +75 -7
  26. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  27. package/lib/cjs/curve/CurveLocationDetail.d.ts +6 -6
  28. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  29. package/lib/cjs/curve/CurveLocationDetail.js +9 -7
  30. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  31. package/lib/cjs/curve/CurvePrimitive.d.ts +4 -3
  32. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  33. package/lib/cjs/curve/CurvePrimitive.js +4 -3
  34. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  35. package/lib/cjs/curve/LineSegment3d.d.ts +6 -4
  36. package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
  37. package/lib/cjs/curve/LineSegment3d.js +4 -4
  38. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  39. package/lib/cjs/curve/LineString3d.d.ts +1 -1
  40. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  41. package/lib/cjs/curve/LineString3d.js +1 -1
  42. package/lib/cjs/curve/LineString3d.js.map +1 -1
  43. package/lib/cjs/curve/Loop.d.ts +7 -5
  44. package/lib/cjs/curve/Loop.d.ts.map +1 -1
  45. package/lib/cjs/curve/Loop.js +18 -6
  46. package/lib/cjs/curve/Loop.js.map +1 -1
  47. package/lib/cjs/curve/ParityRegion.d.ts +7 -7
  48. package/lib/cjs/curve/ParityRegion.d.ts.map +1 -1
  49. package/lib/cjs/curve/ParityRegion.js +19 -11
  50. package/lib/cjs/curve/ParityRegion.js.map +1 -1
  51. package/lib/cjs/curve/Path.d.ts +6 -6
  52. package/lib/cjs/curve/Path.d.ts.map +1 -1
  53. package/lib/cjs/curve/Path.js +15 -9
  54. package/lib/cjs/curve/Path.js.map +1 -1
  55. package/lib/cjs/curve/ProxyCurve.d.ts +4 -6
  56. package/lib/cjs/curve/ProxyCurve.d.ts.map +1 -1
  57. package/lib/cjs/curve/ProxyCurve.js +7 -7
  58. package/lib/cjs/curve/ProxyCurve.js.map +1 -1
  59. package/lib/cjs/curve/RegionOps.d.ts +69 -47
  60. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  61. package/lib/cjs/curve/RegionOps.js +70 -47
  62. package/lib/cjs/curve/RegionOps.js.map +1 -1
  63. package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
  64. package/lib/cjs/curve/StrokeOptions.js +6 -2
  65. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  66. package/lib/cjs/curve/UnionRegion.d.ts +6 -5
  67. package/lib/cjs/curve/UnionRegion.d.ts.map +1 -1
  68. package/lib/cjs/curve/UnionRegion.js +17 -8
  69. package/lib/cjs/curve/UnionRegion.js.map +1 -1
  70. package/lib/cjs/curve/internalContexts/GapSearchContext.d.ts +2 -1
  71. package/lib/cjs/curve/internalContexts/GapSearchContext.d.ts.map +1 -1
  72. package/lib/cjs/curve/internalContexts/GapSearchContext.js +6 -2
  73. package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
  74. package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +4 -0
  75. package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
  76. package/lib/cjs/curve/internalContexts/MultiChainCollector.js +5 -2
  77. package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
  78. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +14 -8
  79. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
  80. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js +14 -8
  81. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  82. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts +56 -34
  83. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  84. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +153 -87
  85. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  86. package/lib/cjs/curve/internalContexts/SumLengthsContext.d.ts.map +1 -1
  87. package/lib/cjs/curve/internalContexts/SumLengthsContext.js +4 -1
  88. package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
  89. package/lib/cjs/geometry3d/Angle.d.ts +9 -0
  90. package/lib/cjs/geometry3d/Angle.d.ts.map +1 -1
  91. package/lib/cjs/geometry3d/Angle.js +13 -0
  92. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  93. package/lib/cjs/geometry3d/BilinearPatch.d.ts +43 -48
  94. package/lib/cjs/geometry3d/BilinearPatch.d.ts.map +1 -1
  95. package/lib/cjs/geometry3d/BilinearPatch.js +51 -55
  96. package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
  97. package/lib/cjs/geometry3d/Ellipsoid.d.ts +1 -1
  98. package/lib/cjs/geometry3d/Ellipsoid.js +1 -1
  99. package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
  100. package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
  101. package/lib/cjs/geometry3d/FrameBuilder.js +13 -11
  102. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  103. package/lib/cjs/geometry3d/GeometryHandler.d.ts +5 -5
  104. package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
  105. package/lib/cjs/geometry3d/Matrix3d.d.ts +18 -0
  106. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  107. package/lib/cjs/geometry3d/Matrix3d.js +27 -0
  108. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  109. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts +36 -32
  110. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
  111. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js +35 -32
  112. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  113. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +8 -0
  114. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  115. package/lib/cjs/geometry3d/Point3dVector3d.js +13 -0
  116. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  117. package/lib/cjs/geometry3d/PolylineOps.d.ts +16 -1
  118. package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
  119. package/lib/cjs/geometry3d/PolylineOps.js +55 -0
  120. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  121. package/lib/cjs/geometry3d/Range.d.ts +134 -94
  122. package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
  123. package/lib/cjs/geometry3d/Range.js +297 -145
  124. package/lib/cjs/geometry3d/Range.js.map +1 -1
  125. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  126. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  127. package/lib/cjs/geometry3d/Transform.d.ts +7 -0
  128. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  129. package/lib/cjs/geometry3d/Transform.js +12 -0
  130. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  131. package/lib/cjs/polyface/PolyfaceQuery.d.ts +64 -6
  132. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  133. package/lib/cjs/polyface/PolyfaceQuery.js +104 -19
  134. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  135. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts +11 -0
  136. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
  137. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js +79 -1
  138. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  139. package/lib/cjs/serialization/GeometrySamples.d.ts +11 -0
  140. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  141. package/lib/cjs/serialization/GeometrySamples.js +30 -0
  142. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  143. package/lib/cjs/solid/LinearSweep.d.ts +2 -1
  144. package/lib/cjs/solid/LinearSweep.d.ts.map +1 -1
  145. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  146. package/lib/cjs/solid/RotationalSweep.d.ts +2 -1
  147. package/lib/cjs/solid/RotationalSweep.d.ts.map +1 -1
  148. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  149. package/lib/cjs/solid/RuledSweep.d.ts +2 -1
  150. package/lib/cjs/solid/RuledSweep.d.ts.map +1 -1
  151. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  152. package/lib/cjs/solid/SweepContour.d.ts +2 -2
  153. package/lib/cjs/solid/SweepContour.d.ts.map +1 -1
  154. package/lib/cjs/solid/SweepContour.js +9 -0
  155. package/lib/cjs/solid/SweepContour.js.map +1 -1
  156. package/lib/esm/clipping/ClipPrimitive.d.ts.map +1 -1
  157. package/lib/esm/clipping/ClipPrimitive.js +2 -0
  158. package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
  159. package/lib/esm/core-geometry.d.ts +1 -0
  160. package/lib/esm/core-geometry.d.ts.map +1 -1
  161. package/lib/esm/core-geometry.js +2 -0
  162. package/lib/esm/core-geometry.js.map +1 -1
  163. package/lib/esm/curve/Arc3d.d.ts +1 -0
  164. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  165. package/lib/esm/curve/Arc3d.js +1 -0
  166. package/lib/esm/curve/Arc3d.js.map +1 -1
  167. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +61 -41
  168. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  169. package/lib/esm/curve/CurveChainWithDistanceIndex.js +69 -46
  170. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  171. package/lib/esm/curve/CurveCollection.d.ts +36 -26
  172. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  173. package/lib/esm/curve/CurveCollection.js +46 -39
  174. package/lib/esm/curve/CurveCollection.js.map +1 -1
  175. package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
  176. package/lib/esm/curve/CurveCurve.js.map +1 -1
  177. package/lib/esm/curve/CurveFactory.d.ts +67 -3
  178. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  179. package/lib/esm/curve/CurveFactory.js +74 -6
  180. package/lib/esm/curve/CurveFactory.js.map +1 -1
  181. package/lib/esm/curve/CurveLocationDetail.d.ts +6 -6
  182. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  183. package/lib/esm/curve/CurveLocationDetail.js +9 -7
  184. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  185. package/lib/esm/curve/CurvePrimitive.d.ts +4 -3
  186. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  187. package/lib/esm/curve/CurvePrimitive.js +4 -3
  188. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  189. package/lib/esm/curve/LineSegment3d.d.ts +6 -4
  190. package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
  191. package/lib/esm/curve/LineSegment3d.js +4 -4
  192. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  193. package/lib/esm/curve/LineString3d.d.ts +1 -1
  194. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  195. package/lib/esm/curve/LineString3d.js +1 -1
  196. package/lib/esm/curve/LineString3d.js.map +1 -1
  197. package/lib/esm/curve/Loop.d.ts +7 -5
  198. package/lib/esm/curve/Loop.d.ts.map +1 -1
  199. package/lib/esm/curve/Loop.js +18 -6
  200. package/lib/esm/curve/Loop.js.map +1 -1
  201. package/lib/esm/curve/ParityRegion.d.ts +7 -7
  202. package/lib/esm/curve/ParityRegion.d.ts.map +1 -1
  203. package/lib/esm/curve/ParityRegion.js +19 -11
  204. package/lib/esm/curve/ParityRegion.js.map +1 -1
  205. package/lib/esm/curve/Path.d.ts +6 -6
  206. package/lib/esm/curve/Path.d.ts.map +1 -1
  207. package/lib/esm/curve/Path.js +15 -9
  208. package/lib/esm/curve/Path.js.map +1 -1
  209. package/lib/esm/curve/ProxyCurve.d.ts +4 -6
  210. package/lib/esm/curve/ProxyCurve.d.ts.map +1 -1
  211. package/lib/esm/curve/ProxyCurve.js +7 -7
  212. package/lib/esm/curve/ProxyCurve.js.map +1 -1
  213. package/lib/esm/curve/RegionOps.d.ts +69 -47
  214. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  215. package/lib/esm/curve/RegionOps.js +70 -47
  216. package/lib/esm/curve/RegionOps.js.map +1 -1
  217. package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
  218. package/lib/esm/curve/StrokeOptions.js +6 -2
  219. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  220. package/lib/esm/curve/UnionRegion.d.ts +6 -5
  221. package/lib/esm/curve/UnionRegion.d.ts.map +1 -1
  222. package/lib/esm/curve/UnionRegion.js +17 -8
  223. package/lib/esm/curve/UnionRegion.js.map +1 -1
  224. package/lib/esm/curve/internalContexts/GapSearchContext.d.ts +2 -1
  225. package/lib/esm/curve/internalContexts/GapSearchContext.d.ts.map +1 -1
  226. package/lib/esm/curve/internalContexts/GapSearchContext.js +6 -2
  227. package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
  228. package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +4 -0
  229. package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
  230. package/lib/esm/curve/internalContexts/MultiChainCollector.js +5 -2
  231. package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
  232. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +14 -8
  233. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
  234. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js +14 -8
  235. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  236. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts +56 -34
  237. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  238. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +153 -87
  239. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  240. package/lib/esm/curve/internalContexts/SumLengthsContext.d.ts.map +1 -1
  241. package/lib/esm/curve/internalContexts/SumLengthsContext.js +4 -1
  242. package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
  243. package/lib/esm/geometry3d/Angle.d.ts +9 -0
  244. package/lib/esm/geometry3d/Angle.d.ts.map +1 -1
  245. package/lib/esm/geometry3d/Angle.js +13 -0
  246. package/lib/esm/geometry3d/Angle.js.map +1 -1
  247. package/lib/esm/geometry3d/BilinearPatch.d.ts +43 -48
  248. package/lib/esm/geometry3d/BilinearPatch.d.ts.map +1 -1
  249. package/lib/esm/geometry3d/BilinearPatch.js +51 -55
  250. package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
  251. package/lib/esm/geometry3d/Ellipsoid.d.ts +1 -1
  252. package/lib/esm/geometry3d/Ellipsoid.js +1 -1
  253. package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
  254. package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
  255. package/lib/esm/geometry3d/FrameBuilder.js +13 -11
  256. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  257. package/lib/esm/geometry3d/GeometryHandler.d.ts +5 -5
  258. package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
  259. package/lib/esm/geometry3d/Matrix3d.d.ts +18 -0
  260. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  261. package/lib/esm/geometry3d/Matrix3d.js +27 -0
  262. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  263. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts +36 -32
  264. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
  265. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js +35 -32
  266. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  267. package/lib/esm/geometry3d/Point3dVector3d.d.ts +8 -0
  268. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  269. package/lib/esm/geometry3d/Point3dVector3d.js +13 -0
  270. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  271. package/lib/esm/geometry3d/PolylineOps.d.ts +16 -1
  272. package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
  273. package/lib/esm/geometry3d/PolylineOps.js +56 -1
  274. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  275. package/lib/esm/geometry3d/Range.d.ts +134 -94
  276. package/lib/esm/geometry3d/Range.d.ts.map +1 -1
  277. package/lib/esm/geometry3d/Range.js +297 -145
  278. package/lib/esm/geometry3d/Range.js.map +1 -1
  279. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  280. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  281. package/lib/esm/geometry3d/Transform.d.ts +7 -0
  282. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  283. package/lib/esm/geometry3d/Transform.js +12 -0
  284. package/lib/esm/geometry3d/Transform.js.map +1 -1
  285. package/lib/esm/polyface/PolyfaceQuery.d.ts +64 -6
  286. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  287. package/lib/esm/polyface/PolyfaceQuery.js +103 -19
  288. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  289. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts +11 -0
  290. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
  291. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js +78 -1
  292. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  293. package/lib/esm/serialization/GeometrySamples.d.ts +11 -0
  294. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  295. package/lib/esm/serialization/GeometrySamples.js +30 -0
  296. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  297. package/lib/esm/solid/LinearSweep.d.ts +2 -1
  298. package/lib/esm/solid/LinearSweep.d.ts.map +1 -1
  299. package/lib/esm/solid/LinearSweep.js.map +1 -1
  300. package/lib/esm/solid/RotationalSweep.d.ts +2 -1
  301. package/lib/esm/solid/RotationalSweep.d.ts.map +1 -1
  302. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  303. package/lib/esm/solid/RuledSweep.d.ts +2 -1
  304. package/lib/esm/solid/RuledSweep.d.ts.map +1 -1
  305. package/lib/esm/solid/RuledSweep.js.map +1 -1
  306. package/lib/esm/solid/SweepContour.d.ts +2 -2
  307. package/lib/esm/solid/SweepContour.d.ts.map +1 -1
  308. package/lib/esm/solid/SweepContour.js +9 -0
  309. package/lib/esm/solid/SweepContour.js.map +1 -1
  310. package/package.json +5 -5
@@ -9,32 +9,32 @@ import { Range3d } from "./Range";
9
9
  import { Ray3d } from "./Ray3d";
10
10
  import { Transform } from "./Transform";
11
11
  /**
12
- * * A Bilinear patch is defined by its 4 corner points.
13
- * * the corner points do not have to be coplanar
14
- *
15
- * * v direction (up)
16
- * |
17
- * |
18
- * |
19
- * point01---A1-----------point11
20
- * | | |
21
- * B0----X------------B1
22
- * | | |
23
- * point00--A0-----------point10 -----------> u direction
24
- *
25
- * * To evaluate aa point at (u,v), the following are equivalent:
26
- * * interpolate with u to get both A0 and A1, viz
12
+ * A bilinear patch is a surface defined by its 4 corner points.
13
+ * * The corner points do not have to be coplanar, but if they are, the quadrilateral should be convex to avoid a self-intersecting surface.
14
+ * ```
15
+ * equation
16
+ * \begin{matrix}
17
+ * v\text{-direction}\\
18
+ * \uparrow\\
19
+ * \text{point01} &\cdots &\text{A1} &\cdots &\text{point11}\\
20
+ * \vdots &&\vdots &&\vdots\\
21
+ * \text{B0} &\cdots &\text{X} &\cdots &\text{B1}\\
22
+ * \vdots &&\vdots &&\vdots\\
23
+ * \text{point00} &\cdots &\text{A0} &\cdots &\text{point10} &\rightarrow~u\text{-direction}
24
+ * \end{matrix}
25
+ * ```
26
+ * * To evaluate the point at (u,v), the following are equivalent:
27
+ * * interpolate first with u then with v:
27
28
  * * A0 = interpolate between point00 and point10 at fraction u
28
29
  * * A1 = interpolate between point01 and point11 at fraction u
29
30
  * * X = interpolate between A0 and A1 at fraction v
30
- * * interpolate first with v to get B0 and B1, viz
31
+ * * interpolate first with v then with u:
31
32
  * * B0 = interpolate between point00 and point01 at fraction v
32
33
  * * B1 = interpolate between point10 and point11 at fraction v
33
34
  * * X = interpolate between B0 and B1 at fraction u
34
- * * sum all at once as
35
- * * X = (1-u)* (1-v) *point00 + (1-u)*v * point01 + u * (1-v) *point10 + u* v * point11
36
- *
37
- * @internal
35
+ * * sum all at once:
36
+ * * X = (1-u)(1-v)point00 + (1-u)(v)point01 + (u)(1-v)point10 + (u)(v)point11
37
+ * @public
38
38
  */
39
39
  export declare class BilinearPatch implements UVSurface {
40
40
  /** corner at parametric coordinate (0,0) */
@@ -46,62 +46,57 @@ export declare class BilinearPatch implements UVSurface {
46
46
  /** corner at parametric coordinate (1,1) */
47
47
  point11: Point3d;
48
48
  /**
49
- * Capture (not clone) corner points, in u direction at v=0, then in same direction at v=1
49
+ * Capture (not clone) corners to create a new BilinearPatch.
50
50
  * @param point00 Point at uv=0,0
51
51
  * @param point10 Point at uv=1,0
52
52
  * @param point10 Point at uv=0,1
53
- * @param point11 Point at uv=11
53
+ * @param point11 Point at uv=1,1
54
54
  */
55
55
  constructor(point00: Point3d, point10: Point3d, point01: Point3d, point11: Point3d);
56
- /** clone (not capture) corners to create a new BilinearPatch
56
+ /**
57
+ * Clone (not capture) corners to create a new BilinearPatch.
57
58
  * @param point00 Point at uv=0,0
58
59
  * @param point10 Point at uv=1,0
59
60
  * @param point10 Point at uv=0,1
60
- * @param point11 Point at uv=11
61
+ * @param point11 Point at uv=1,1
61
62
  */
62
63
  static create(point00: Point3d, point10: Point3d, point01: Point3d, point11: Point3d): BilinearPatch;
63
- /** create a patch with from xyz values of the 4 corners
64
- */
64
+ /** Create a patch from xyz values of the 4 corners. */
65
65
  static createXYZ(x00: number, y00: number, z00: number, x10: number, y10: number, z10: number, x01: number, y01: number, z01: number, x11: number, y11: number, z11: number): BilinearPatch;
66
- /** return a clone with same coordinates */
66
+ /** Return a cloned patch. */
67
67
  clone(): BilinearPatch;
68
- /** test equality of the 4 points */
68
+ /** Test equality of the 4 points. */
69
69
  isAlmostEqual(other: BilinearPatch): boolean;
70
- /** Apply the transform to each point */
70
+ /** Apply the transform to each point. */
71
71
  tryTransformInPlace(transform: Transform): boolean;
72
- /**
73
- * return a cloned and transformed patch.
74
- * @param transform
75
- */
72
+ /** Return a cloned and transformed patch. */
76
73
  cloneTransformed(transform: Transform): BilinearPatch | undefined;
77
- /** Extend a range by the range of the(optionally transformed) patch
78
- */
74
+ /** Extend a range by the range of the (optionally transformed) patch. */
79
75
  extendRange(range: Range3d, transform?: Transform): void;
80
- /** Evaluate as a uv surface
81
- * @param u fractional position in minor (phi)
82
- * @param v fractional position on major (theta) arc
76
+ /**
77
+ * Convert fractional u and v coordinates to surface point
78
+ * @param u fractional coordinate in u direction
79
+ * @param v fractional coordinate in v direction
80
+ * @param result optional pre-allocated point
83
81
  */
84
82
  uvFractionToPoint(u: number, v: number, result?: Point3d): Point3d;
85
83
  /** Evaluate as a uv surface, returning point and two derivative vectors.
86
- * @param u fractional position
87
- * @param v fractional position
84
+ * @param u fractional coordinate in u direction
85
+ * @param v fractional coordinate in v direction
86
+ * @param result optional pre-allocated carrier for point and vectors
88
87
  */
89
88
  uvFractionToPointAndTangents(u: number, v: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors;
90
- /** if data[ib][pivotColumn] is larger (abs) than data[ia][pivotColumn] swap the iA and iB arrays */
89
+ /** If data[iB][pivotColumn] is larger in absolute value than data[iA][pivotColumn], then swap rows iA and iB. */
91
90
  private static conditionalPivot;
92
91
  /**
93
- * Compute the (points of) intersection with a ray.
92
+ * Compute the points of intersection with a ray.
94
93
  * @param ray ray in space
95
94
  * @returns 1 or 2 points if there are intersections, undefined if no intersections
96
95
  */
97
96
  intersectRay(ray: Ray3d): CurveAndSurfaceLocationDetail[] | undefined;
98
- /**
99
- * Returns the larger of the u-direction edge lengths at v=0 and v=1
100
- */
97
+ /** Returns the larger of the u-direction edge lengths at v=0 and v=1. */
101
98
  maxUEdgeLength(): number;
102
- /**
103
- * Returns the larger of the v-direction edge lengths at u=0 and u=1
104
- */
99
+ /** Returns the larger of the v-direction edge lengths at u=0 and u=1. */
105
100
  maxVEdgeLength(): number;
106
101
  }
107
102
  //# sourceMappingURL=BilinearPatch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BilinearPatch.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/BilinearPatch.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,6BAA6B,EAA2B,MAAM,kCAAkC,CAAC;AAI1G,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,aAAc,YAAW,SAAS;IAC7C,4CAA4C;IACrC,OAAO,EAAE,OAAO,CAAC;IACxB,4CAA4C;IACrC,OAAO,EAAE,OAAO,CAAC;IACxB,4CAA4C;IACrC,OAAO,EAAE,OAAO,CAAC;IACxB,4CAA4C;IACrC,OAAO,EAAE,OAAO,CAAC;IACxB;;;;;;OAMG;gBACgB,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO;IAMzF;;;;;OAKG;WACW,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO;IAI3F;OACG;WACW,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE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C,SAAS,EAAE,SAAS,GAAG,OAAO;IAOzD,6CAA6C;IACtC,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,aAAa,GAAG,SAAS;IAKxE,yEAAyE;IAClE,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS;IAaxD;;;;;OAKG;IACI,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;IAYzE;;;;OAIG;IACI,4BAA4B,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,yBAAyB,GAAG,yBAAyB;IAsBxH,iHAAiH;IACjH,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAO/B;;;;OAIG;IACI,YAAY,CAAC,GAAG,EAAE,KAAK,GAAG,6BAA6B,EAAE,GAAG,SAAS;IAsC5E,yEAAyE;IAClE,cAAc,IAAI,MAAM;IAG/B,yEAAyE;IAClE,cAAc,IAAI,MAAM;CAGhC"}
@@ -11,41 +11,42 @@ import { Geometry } from "../Geometry";
11
11
  import { SmallSystem } from "../numerics/Polynomials";
12
12
  import { Plane3dByOriginAndVectors } from "./Plane3dByOriginAndVectors";
13
13
  import { Point3d } from "./Point3dVector3d";
14
+ // cspell:word uparrow, rightarrow
14
15
  /**
15
- * * A Bilinear patch is defined by its 4 corner points.
16
- * * the corner points do not have to be coplanar
17
- *
18
- * * v direction (up)
19
- * |
20
- * |
21
- * |
22
- * point01---A1-----------point11
23
- * | | |
24
- * B0----X------------B1
25
- * | | |
26
- * point00--A0-----------point10 -----------> u direction
27
- *
28
- * * To evaluate aa point at (u,v), the following are equivalent:
29
- * * interpolate with u to get both A0 and A1, viz
16
+ * A bilinear patch is a surface defined by its 4 corner points.
17
+ * * The corner points do not have to be coplanar, but if they are, the quadrilateral should be convex to avoid a self-intersecting surface.
18
+ * ```
19
+ * equation
20
+ * \begin{matrix}
21
+ * v\text{-direction}\\
22
+ * \uparrow\\
23
+ * \text{point01} &\cdots &\text{A1} &\cdots &\text{point11}\\
24
+ * \vdots &&\vdots &&\vdots\\
25
+ * \text{B0} &\cdots &\text{X} &\cdots &\text{B1}\\
26
+ * \vdots &&\vdots &&\vdots\\
27
+ * \text{point00} &\cdots &\text{A0} &\cdots &\text{point10} &\rightarrow~u\text{-direction}
28
+ * \end{matrix}
29
+ * ```
30
+ * * To evaluate the point at (u,v), the following are equivalent:
31
+ * * interpolate first with u then with v:
30
32
  * * A0 = interpolate between point00 and point10 at fraction u
31
33
  * * A1 = interpolate between point01 and point11 at fraction u
32
34
  * * X = interpolate between A0 and A1 at fraction v
33
- * * interpolate first with v to get B0 and B1, viz
35
+ * * interpolate first with v then with u:
34
36
  * * B0 = interpolate between point00 and point01 at fraction v
35
37
  * * B1 = interpolate between point10 and point11 at fraction v
36
38
  * * X = interpolate between B0 and B1 at fraction u
37
- * * sum all at once as
38
- * * X = (1-u)* (1-v) *point00 + (1-u)*v * point01 + u * (1-v) *point10 + u* v * point11
39
- *
40
- * @internal
39
+ * * sum all at once:
40
+ * * X = (1-u)(1-v)point00 + (1-u)(v)point01 + (u)(1-v)point10 + (u)(v)point11
41
+ * @public
41
42
  */
42
43
  export class BilinearPatch {
43
44
  /**
44
- * Capture (not clone) corner points, in u direction at v=0, then in same direction at v=1
45
+ * Capture (not clone) corners to create a new BilinearPatch.
45
46
  * @param point00 Point at uv=0,0
46
47
  * @param point10 Point at uv=1,0
47
48
  * @param point10 Point at uv=0,1
48
- * @param point11 Point at uv=11
49
+ * @param point11 Point at uv=1,1
49
50
  */
50
51
  constructor(point00, point10, point01, point11) {
51
52
  this.point00 = point00;
@@ -53,32 +54,32 @@ export class BilinearPatch {
53
54
  this.point01 = point01;
54
55
  this.point11 = point11;
55
56
  }
56
- /** clone (not capture) corners to create a new BilinearPatch
57
+ /**
58
+ * Clone (not capture) corners to create a new BilinearPatch.
57
59
  * @param point00 Point at uv=0,0
58
60
  * @param point10 Point at uv=1,0
59
61
  * @param point10 Point at uv=0,1
60
- * @param point11 Point at uv=11
62
+ * @param point11 Point at uv=1,1
61
63
  */
62
64
  static create(point00, point10, point01, point11) {
63
65
  return new BilinearPatch(point00.clone(), point10.clone(), point01.clone(), point11.clone());
64
66
  }
65
- /** create a patch with from xyz values of the 4 corners
66
- */
67
+ /** Create a patch from xyz values of the 4 corners. */
67
68
  static createXYZ(x00, y00, z00, x10, y10, z10, x01, y01, z01, x11, y11, z11) {
68
69
  return new BilinearPatch(Point3d.create(x00, y00, z00), Point3d.create(x10, y10, z10), Point3d.create(x01, y01, z01), Point3d.create(x11, y11, z11));
69
70
  }
70
- /** return a clone with same coordinates */
71
+ /** Return a cloned patch. */
71
72
  clone() {
72
73
  return new BilinearPatch(this.point00.clone(), this.point10.clone(), this.point01.clone(), this.point11.clone());
73
74
  }
74
- /** test equality of the 4 points */
75
+ /** Test equality of the 4 points. */
75
76
  isAlmostEqual(other) {
76
77
  return this.point00.isAlmostEqual(other.point00)
77
78
  && this.point10.isAlmostEqual(other.point10)
78
79
  && this.point01.isAlmostEqual(other.point01)
79
80
  && this.point11.isAlmostEqual(other.point11);
80
81
  }
81
- /** Apply the transform to each point */
82
+ /** Apply the transform to each point. */
82
83
  tryTransformInPlace(transform) {
83
84
  transform.multiplyPoint3d(this.point00, this.point00);
84
85
  transform.multiplyPoint3d(this.point10, this.point10);
@@ -86,17 +87,13 @@ export class BilinearPatch {
86
87
  transform.multiplyPoint3d(this.point11, this.point11);
87
88
  return true;
88
89
  }
89
- /**
90
- * return a cloned and transformed patch.
91
- * @param transform
92
- */
90
+ /** Return a cloned and transformed patch. */
93
91
  cloneTransformed(transform) {
94
92
  const result = this.clone();
95
93
  result.tryTransformInPlace(transform);
96
94
  return result;
97
95
  }
98
- /** Extend a range by the range of the(optionally transformed) patch
99
- */
96
+ /** Extend a range by the range of the (optionally transformed) patch. */
100
97
  extendRange(range, transform) {
101
98
  if (transform) {
102
99
  range.extendTransformedPoint(transform, this.point00);
@@ -111,9 +108,11 @@ export class BilinearPatch {
111
108
  range.extendPoint(this.point11);
112
109
  }
113
110
  }
114
- /** Evaluate as a uv surface
115
- * @param u fractional position in minor (phi)
116
- * @param v fractional position on major (theta) arc
111
+ /**
112
+ * Convert fractional u and v coordinates to surface point
113
+ * @param u fractional coordinate in u direction
114
+ * @param v fractional coordinate in v direction
115
+ * @param result optional pre-allocated point
117
116
  */
118
117
  uvFractionToPoint(u, v, result) {
119
118
  const f00 = (1.0 - u) * (1.0 - v);
@@ -123,8 +122,9 @@ export class BilinearPatch {
123
122
  return Point3d.create(f00 * this.point00.x + f10 * this.point10.x + f01 * this.point01.x + f11 * this.point11.x, f00 * this.point00.y + f10 * this.point10.y + f01 * this.point01.y + f11 * this.point11.y, f00 * this.point00.z + f10 * this.point10.z + f01 * this.point01.z + f11 * this.point11.z, result);
124
123
  }
125
124
  /** Evaluate as a uv surface, returning point and two derivative vectors.
126
- * @param u fractional position
127
- * @param v fractional position
125
+ * @param u fractional coordinate in u direction
126
+ * @param v fractional coordinate in v direction
127
+ * @param result optional pre-allocated carrier for point and vectors
128
128
  */
129
129
  uvFractionToPointAndTangents(u, v, result) {
130
130
  const u0 = 1.0 - u;
@@ -139,7 +139,7 @@ export class BilinearPatch {
139
139
  // v derivative ..
140
140
  u0 * (this.point01.x - this.point00.x) + u * (this.point11.x - this.point10.x), u0 * (this.point01.y - this.point00.y) + u * (this.point11.y - this.point10.y), u0 * (this.point01.z - this.point00.z) + u * (this.point11.z - this.point10.z), result);
141
141
  }
142
- /** if data[ib][pivotColumn] is larger (abs) than data[ia][pivotColumn] swap the iA and iB arrays */
142
+ /** If data[iB][pivotColumn] is larger in absolute value than data[iA][pivotColumn], then swap rows iA and iB. */
143
143
  static conditionalPivot(pivotColumn, data, iA, iB) {
144
144
  if (Math.abs(data[iB][pivotColumn]) > Math.abs(data[iA][pivotColumn])) {
145
145
  const q = data[iA];
@@ -148,7 +148,7 @@ export class BilinearPatch {
148
148
  }
149
149
  }
150
150
  /**
151
- * Compute the (points of) intersection with a ray.
151
+ * Compute the points of intersection with a ray.
152
152
  * @param ray ray in space
153
153
  * @returns 1 or 2 points if there are intersections, undefined if no intersections
154
154
  */
@@ -157,17 +157,17 @@ export class BilinearPatch {
157
157
  const vectorV = this.point01.minus(this.point00);
158
158
  const vectorW = this.point11.minus(this.point10);
159
159
  vectorW.subtractInPlace(vectorV);
160
- // coefficients of (each component of)
161
- // `ray.origin + t * ray.direction = point00 + u * vectorU + v * vectorV + u*v*vectorW`
162
- // for x as typical direction as x, the scalar equation with coefficient order for arrays is
163
- // `0 = -ray.origin.x * t + (point00.x - ray.origin.x) + u * vectorU.x + v * vectorV.x + u * v * vectorW.x`
164
- // (and that particular equation is invoked to isolate t when uv is known)
160
+ // We seek t, u, v such that:
161
+ // `ray.origin + t*ray.direction = point00 + u*vectorU + v*vectorV + u*v*vectorW`
162
+ // For typical direction as x, the scalar equation with coefficient order for arrays is:
163
+ // `0 = -t*ray.direction.x + (point00.x - ray.origin.x) + u*vectorU.x + v*vectorV.x + u*v*vectorW.x`
164
+ // and this particular equation is invoked to compute t when u and v are known.
165
165
  const coffs = [
166
166
  new Float64Array([-ray.direction.x, this.point00.x - ray.origin.x, vectorU.x, vectorV.x, vectorW.x]),
167
167
  new Float64Array([-ray.direction.y, this.point00.y - ray.origin.y, vectorU.y, vectorV.y, vectorW.y]),
168
- new Float64Array([-ray.direction.z, this.point00.z - ray.origin.z, vectorU.z, vectorV.z, vectorW.z])
168
+ new Float64Array([-ray.direction.z, this.point00.z - ray.origin.z, vectorU.z, vectorV.z, vectorW.z]),
169
169
  ];
170
- // bring the largest ray.direction coefficient to the 0 equation.
170
+ // swap rows so that the equation with largest ray.direction coefficient is first.
171
171
  BilinearPatch.conditionalPivot(0, coffs, 0, 1);
172
172
  BilinearPatch.conditionalPivot(0, coffs, 0, 2);
173
173
  SmallSystem.eliminateFromPivot(coffs[0], 0, coffs[1], -1.0);
@@ -184,15 +184,11 @@ export class BilinearPatch {
184
184
  }
185
185
  return undefined;
186
186
  }
187
- /**
188
- * Returns the larger of the u-direction edge lengths at v=0 and v=1
189
- */
187
+ /** Returns the larger of the u-direction edge lengths at v=0 and v=1. */
190
188
  maxUEdgeLength() {
191
189
  return Geometry.maxXY(this.point00.distance(this.point10), this.point01.distance(this.point11));
192
190
  }
193
- /**
194
- * Returns the larger of the v-direction edge lengths at u=0 and u=1
195
- */
191
+ /** Returns the larger of the v-direction edge lengths at u=0 and u=1. */
196
192
  maxVEdgeLength() {
197
193
  return Geometry.maxXY(this.point00.distance(this.point01), this.point10.distance(this.point11));
198
194
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BilinearPatch.js","sourceRoot":"","sources":["../../../src/geometry3d/BilinearPatch.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,6BAA6B,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC1G,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAK5C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,OAAO,aAAa;IASxB;;;;;;OAMG;IACH,YAAmB,OAAgB,EAAE,OAAgB,EAAE,OAAgB,EAAE,OAAgB;QACvF,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IACD;;;;;OAKG;IACI,MAAM,CAAC,MAAM,CAAC,OAAgB,E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C,CAAC,CAAC,CAAC;gBACxG,MAAM,KAAK,GAAG,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;gBACrC,MAAM,CAAC,IAAI,CAAC,IAAI,6BAA6B,CAC3C,mBAAmB,CAAC,sBAAsB,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,EACzD,uBAAuB,CAAC,oBAAoB,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;aACnE;YACD,OAAO,MAAM,CAAC;SACf;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD;;OAEG;IACI,cAAc;QACnB,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAClG,CAAC;IACD;;OAEG;IACI,cAAc;QACnB,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAClG,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 Solid\r\n */\r\n\r\nimport { CurveAndSurfaceLocationDetail, UVSurfaceLocationDetail } from \"../bspline/SurfaceLocationDetail\";\r\nimport { CurveLocationDetail } from \"../curve/CurveLocationDetail\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { SmallSystem } from \"../numerics/Polynomials\";\r\nimport { UVSurface } from \"./GeometryHandler\";\r\nimport { Plane3dByOriginAndVectors } from \"./Plane3dByOriginAndVectors\";\r\nimport { Point3d } from \"./Point3dVector3d\";\r\nimport { Range3d } from \"./Range\";\r\nimport { Ray3d } from \"./Ray3d\";\r\nimport { Transform } from \"./Transform\";\r\n\r\n/**\r\n * * A Bilinear patch is defined by its 4 corner points.\r\n * * the corner points do not have to be coplanar\r\n *\r\n * * v direction (up)\r\n * |\r\n * |\r\n * |\r\n * point01---A1-----------point11\r\n * | | |\r\n * B0----X------------B1\r\n * | | |\r\n * point00--A0-----------point10 -----------> u direction\r\n *\r\n * * To evaluate aa point at (u,v), the following are equivalent:\r\n * * interpolate with u to get both A0 and A1, viz\r\n * * A0 = interpolate between point00 and point10 at fraction u\r\n * * A1 = interpolate between point01 and point11 at fraction u\r\n * * X = interpolate between A0 and A1 at fraction v\r\n * * interpolate first with v to get B0 and B1, viz\r\n * * B0 = interpolate between point00 and point01 at fraction v\r\n * * B1 = interpolate between point10 and point11 at fraction v\r\n * * X = interpolate between B0 and B1 at fraction u\r\n * * sum all at once as\r\n * * X = (1-u)* (1-v) *point00 + (1-u)*v * point01 + u * (1-v) *point10 + u* v * point11\r\n *\r\n * @internal\r\n */\r\nexport class BilinearPatch implements UVSurface {\r\n /** corner at parametric coordinate (0,0) */\r\n public point00: Point3d;\r\n /** corner at parametric coordinate (1,0) */\r\n public point10: Point3d;\r\n /** corner at parametric coordinate (0,1) */\r\n public point01: Point3d;\r\n /** corner at parametric coordinate (1,1) */\r\n public point11: Point3d;\r\n /**\r\n * Capture (not clone) corner points, in u direction at v=0, then in same direction at v=1\r\n * @param point00 Point at uv=0,0\r\n * @param point10 Point at uv=1,0\r\n * @param point10 Point at uv=0,1\r\n * @param point11 Point at uv=11\r\n */\r\n public constructor(point00: Point3d, point10: Point3d, point01: Point3d, point11: Point3d) {\r\n this.point00 = point00;\r\n this.point10 = point10;\r\n this.point01 = point01;\r\n this.point11 = point11;\r\n }\r\n /** clone (not capture) corners to create a new BilinearPatch\r\n * @param point00 Point at uv=0,0\r\n * @param point10 Point at uv=1,0\r\n * @param point10 Point at uv=0,1\r\n * @param point11 Point at uv=11\r\n */\r\n public static create(point00: Point3d, point10: Point3d, point01: Point3d, point11: Point3d) {\r\n return new BilinearPatch(point00.clone(), point10.clone(), point01.clone(), point11.clone());\r\n }\r\n\r\n /** create a patch with from xyz values of the 4 corners\r\n */\r\n public static createXYZ(x00: number, y00: number, z00: number,\r\n x10: number, y10: number, z10: number,\r\n x01: number, y01: number, z01: number,\r\n x11: number, y11: number, z11: number) {\r\n return new BilinearPatch(Point3d.create(x00, y00, z00),\r\n Point3d.create(x10, y10, z10),\r\n Point3d.create(x01, y01, z01),\r\n Point3d.create(x11, y11, z11));\r\n }\r\n\r\n /** return a clone with same coordinates */\r\n public clone(): BilinearPatch {\r\n return new BilinearPatch(\r\n this.point00.clone(),\r\n this.point10.clone(),\r\n this.point01.clone(),\r\n this.point11.clone());\r\n }\r\n /** test equality of the 4 points */\r\n public isAlmostEqual(other: BilinearPatch): boolean {\r\n return this.point00.isAlmostEqual(other.point00)\r\n && this.point10.isAlmostEqual(other.point10)\r\n && this.point01.isAlmostEqual(other.point01)\r\n && this.point11.isAlmostEqual(other.point11);\r\n }\r\n /** Apply the transform to each point */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n transform.multiplyPoint3d(this.point00, this.point00);\r\n transform.multiplyPoint3d(this.point10, this.point10);\r\n transform.multiplyPoint3d(this.point01, this.point01);\r\n transform.multiplyPoint3d(this.point11, this.point11);\r\n return true;\r\n }\r\n /**\r\n * return a cloned and transformed patch.\r\n * @param transform\r\n */\r\n public cloneTransformed(transform: Transform): BilinearPatch | undefined {\r\n const result = this.clone();\r\n result.tryTransformInPlace(transform);\r\n return result;\r\n }\r\n /** Extend a range by the range of the(optionally transformed) patch\r\n */\r\n public extendRange(range: Range3d, transform?: Transform) {\r\n if (transform) {\r\n range.extendTransformedPoint(transform, this.point00);\r\n range.extendTransformedPoint(transform, this.point10);\r\n range.extendTransformedPoint(transform, this.point01);\r\n range.extendTransformedPoint(transform, this.point11);\r\n } else {\r\n range.extendPoint(this.point00);\r\n range.extendPoint(this.point10);\r\n range.extendPoint(this.point01);\r\n range.extendPoint(this.point11);\r\n }\r\n }\r\n /** Evaluate as a uv surface\r\n * @param u fractional position in minor (phi)\r\n * @param v fractional position on major (theta) arc\r\n */\r\n public uvFractionToPoint(u: number, v: number, result?: Point3d): Point3d {\r\n const f00 = (1.0 - u) * (1.0 - v);\r\n const f10 = u * (1.0 - v);\r\n const f01 = (1.0 - u) * v;\r\n const f11 = u * v;\r\n return Point3d.create(\r\n f00 * this.point00.x + f10 * this.point10.x + f01 * this.point01.x + f11 * this.point11.x,\r\n f00 * this.point00.y + f10 * this.point10.y + f01 * this.point01.y + f11 * this.point11.y,\r\n f00 * this.point00.z + f10 * this.point10.z + f01 * this.point01.z + f11 * this.point11.z,\r\n result);\r\n }\r\n /** Evaluate as a uv surface, returning point and two derivative vectors.\r\n * @param u fractional position\r\n * @param v fractional position\r\n */\r\n public uvFractionToPointAndTangents(u: number, v: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\r\n const u0 = 1.0 - u;\r\n const v0 = 1.0 - v;\r\n const f00 = u0 * v0;\r\n const f10 = u * v0;\r\n const f01 = u0 * v;\r\n const f11 = u * v;\r\n return Plane3dByOriginAndVectors.createOriginAndVectorsXYZ(\r\n f00 * this.point00.x + f10 * this.point10.x + f01 * this.point01.x + f11 * this.point11.x,\r\n f00 * this.point00.y + f10 * this.point10.y + f01 * this.point01.y + f11 * this.point11.y,\r\n f00 * this.point00.z + f10 * this.point10.z + f01 * this.point01.z + f11 * this.point11.z,\r\n // u derivative ..\r\n v0 * (this.point10.x - this.point00.x) + v * (this.point11.x - this.point01.x),\r\n v0 * (this.point10.y - this.point00.y) + v * (this.point11.y - this.point01.y),\r\n v0 * (this.point10.z - this.point00.z) + v * (this.point11.z - this.point01.z),\r\n // v derivative ..\r\n u0 * (this.point01.x - this.point00.x) + u * (this.point11.x - this.point10.x),\r\n u0 * (this.point01.y - this.point00.y) + u * (this.point11.y - this.point10.y),\r\n u0 * (this.point01.z - this.point00.z) + u * (this.point11.z - this.point10.z),\r\n result);\r\n }\r\n /** if data[ib][pivotColumn] is larger (abs) than data[ia][pivotColumn] swap the iA and iB arrays */\r\n private static conditionalPivot(pivotColumn: number, data: Float64Array[], iA: number, iB: number) {\r\n if (Math.abs(data[iB][pivotColumn]) > Math.abs(data[iA][pivotColumn])) {\r\n const q = data[iA];\r\n data[iA] = data[iB];\r\n data[iB] = q;\r\n }\r\n }\r\n /**\r\n * Compute the (points of) intersection with a ray.\r\n * @param ray ray in space\r\n * @returns 1 or 2 points if there are intersections, undefined if no intersections\r\n */\r\n public intersectRay(ray: Ray3d): CurveAndSurfaceLocationDetail[] | undefined {\r\n const vectorU = this.point10.minus(this.point00);\r\n const vectorV = this.point01.minus(this.point00);\r\n const vectorW = this.point11.minus(this.point10);\r\n vectorW.subtractInPlace(vectorV);\r\n // coefficients of (each component of)\r\n // `ray.origin + t * ray.direction = point00 + u * vectorU + v * vectorV + u*v*vectorW`\r\n // for x as typical direction as x, the scalar equation with coefficient order for arrays is\r\n // `0 = -ray.origin.x * t + (point00.x - ray.origin.x) + u * vectorU.x + v * vectorV.x + u * v * vectorW.x`\r\n // (and that particular equation is invoked to isolate t when uv is known)\r\n const coffs = [\r\n new Float64Array([-ray.direction.x, this.point00.x - ray.origin.x, vectorU.x, vectorV.x, vectorW.x]),\r\n new Float64Array([-ray.direction.y, this.point00.y - ray.origin.y, vectorU.y, vectorV.y, vectorW.y]),\r\n new Float64Array([-ray.direction.z, this.point00.z - ray.origin.z, vectorU.z, vectorV.z, vectorW.z])];\r\n // bring the largest ray.direction coefficient to the 0 equation.\r\n BilinearPatch.conditionalPivot(0, coffs, 0, 1);\r\n BilinearPatch.conditionalPivot(0, coffs, 0, 2);\r\n SmallSystem.eliminateFromPivot(coffs[0], 0, coffs[1], -1.0);\r\n SmallSystem.eliminateFromPivot(coffs[0], 0, coffs[2], -1.0);\r\n const uvArray = SmallSystem.solveBilinearPair(\r\n coffs[1][1], coffs[1][2], coffs[1][3], coffs[1][4],\r\n coffs[2][1], coffs[2][2], coffs[2][3], coffs[2][4]);\r\n if (uvArray) {\r\n const result: CurveAndSurfaceLocationDetail[] = [];\r\n for (const uv of uvArray) {\r\n const t = -(coffs[0][1] + coffs[0][2] * uv.x + (coffs[0][3] + coffs[0][4] * uv.x) * uv.y) / coffs[0][0];\r\n const point = ray.fractionToPoint(t);\r\n result.push(new CurveAndSurfaceLocationDetail(\r\n CurveLocationDetail.createRayFractionPoint(ray, t, point),\r\n UVSurfaceLocationDetail.createSurfaceUVPoint(this, uv, point)));\r\n }\r\n return result;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Returns the larger of the u-direction edge lengths at v=0 and v=1\r\n */\r\n public maxUEdgeLength(): number {\r\n return Geometry.maxXY(this.point00.distance(this.point10), this.point01.distance(this.point11));\r\n }\r\n /**\r\n * Returns the larger of the v-direction edge lengths at u=0 and u=1\r\n */\r\n public maxVEdgeLength(): number {\r\n return Geometry.maxXY(this.point00.distance(this.point01), this.point10.distance(this.point11));\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"BilinearPatch.js","sourceRoot":"","sources":["../../../src/geometry3d/BilinearPatch.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,6BAA6B,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC1G,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAK5C,kCAAkC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,OAAO,aAAa;IASxB;;;;;;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,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACxG,MAAM,KAAK,GAAG,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;gBACrC,MAAM,CAAC,IAAI,CAAC,IAAI,6BAA6B,CAC3C,mBAAmB,CAAC,sBAAsB,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,EACzD,uBAAuB,CAAC,oBAAoB,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,CAC/D,CAAC;aACH;YACD,OAAO,MAAM,CAAC;SACf;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,yEAAyE;IAClE,cAAc;QACnB,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAClG,CAAC;IACD,yEAAyE;IAClE,cAAc;QACnB,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAClG,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 Solid\r\n */\r\n\r\nimport { CurveAndSurfaceLocationDetail, UVSurfaceLocationDetail } from \"../bspline/SurfaceLocationDetail\";\r\nimport { CurveLocationDetail } from \"../curve/CurveLocationDetail\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { SmallSystem } from \"../numerics/Polynomials\";\r\nimport { UVSurface } from \"./GeometryHandler\";\r\nimport { Plane3dByOriginAndVectors } from \"./Plane3dByOriginAndVectors\";\r\nimport { Point3d } from \"./Point3dVector3d\";\r\nimport { Range3d } from \"./Range\";\r\nimport { Ray3d } from \"./Ray3d\";\r\nimport { Transform } from \"./Transform\";\r\n\r\n// cspell:word uparrow, rightarrow\r\n\r\n/**\r\n * A bilinear patch is a surface defined by its 4 corner points.\r\n * * The corner points do not have to be coplanar, but if they are, the quadrilateral should be convex to avoid a self-intersecting surface.\r\n * ```\r\n * equation\r\n * \\begin{matrix}\r\n * v\\text{-direction}\\\\\r\n * \\uparrow\\\\\r\n * \\text{point01} &\\cdots &\\text{A1} &\\cdots &\\text{point11}\\\\\r\n * \\vdots &&\\vdots &&\\vdots\\\\\r\n * \\text{B0} &\\cdots &\\text{X} &\\cdots &\\text{B1}\\\\\r\n * \\vdots &&\\vdots &&\\vdots\\\\\r\n * \\text{point00} &\\cdots &\\text{A0} &\\cdots &\\text{point10} &\\rightarrow~u\\text{-direction}\r\n * \\end{matrix}\r\n * ```\r\n * * To evaluate the point at (u,v), the following are equivalent:\r\n * * interpolate first with u then with v:\r\n * * A0 = interpolate between point00 and point10 at fraction u\r\n * * A1 = interpolate between point01 and point11 at fraction u\r\n * * X = interpolate between A0 and A1 at fraction v\r\n * * interpolate first with v then with u:\r\n * * B0 = interpolate between point00 and point01 at fraction v\r\n * * B1 = interpolate between point10 and point11 at fraction v\r\n * * X = interpolate between B0 and B1 at fraction u\r\n * * sum all at once:\r\n * * X = (1-u)(1-v)point00 + (1-u)(v)point01 + (u)(1-v)point10 + (u)(v)point11\r\n * @public\r\n */\r\nexport class BilinearPatch implements UVSurface {\r\n /** corner at parametric coordinate (0,0) */\r\n public point00: Point3d;\r\n /** corner at parametric coordinate (1,0) */\r\n public point10: Point3d;\r\n /** corner at parametric coordinate (0,1) */\r\n public point01: Point3d;\r\n /** corner at parametric coordinate (1,1) */\r\n public point11: Point3d;\r\n /**\r\n * Capture (not clone) corners to create a new BilinearPatch.\r\n * @param point00 Point at uv=0,0\r\n * @param point10 Point at uv=1,0\r\n * @param point10 Point at uv=0,1\r\n * @param point11 Point at uv=1,1\r\n */\r\n public constructor(point00: Point3d, point10: Point3d, point01: Point3d, point11: Point3d) {\r\n this.point00 = point00;\r\n this.point10 = point10;\r\n this.point01 = point01;\r\n this.point11 = point11;\r\n }\r\n /**\r\n * Clone (not capture) corners to create a new BilinearPatch.\r\n * @param point00 Point at uv=0,0\r\n * @param point10 Point at uv=1,0\r\n * @param point10 Point at uv=0,1\r\n * @param point11 Point at uv=1,1\r\n */\r\n public static create(point00: Point3d, point10: Point3d, point01: Point3d, point11: Point3d) {\r\n return new BilinearPatch(point00.clone(), point10.clone(), point01.clone(), point11.clone());\r\n }\r\n /** Create a patch from xyz values of the 4 corners. */\r\n public static createXYZ(\r\n x00: number, y00: number, z00: number,\r\n x10: number, y10: number, z10: number,\r\n x01: number, y01: number, z01: number,\r\n x11: number, y11: number, z11: number\r\n ) {\r\n return new BilinearPatch(\r\n Point3d.create(x00, y00, z00),\r\n Point3d.create(x10, y10, z10),\r\n Point3d.create(x01, y01, z01),\r\n Point3d.create(x11, y11, z11)\r\n );\r\n }\r\n /** Return a cloned patch. */\r\n public clone(): BilinearPatch {\r\n return new BilinearPatch(\r\n this.point00.clone(),\r\n this.point10.clone(),\r\n this.point01.clone(),\r\n this.point11.clone()\r\n );\r\n }\r\n /** Test equality of the 4 points. */\r\n public isAlmostEqual(other: BilinearPatch): boolean {\r\n return this.point00.isAlmostEqual(other.point00)\r\n && this.point10.isAlmostEqual(other.point10)\r\n && this.point01.isAlmostEqual(other.point01)\r\n && this.point11.isAlmostEqual(other.point11);\r\n }\r\n /** Apply the transform to each point. */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n transform.multiplyPoint3d(this.point00, this.point00);\r\n transform.multiplyPoint3d(this.point10, this.point10);\r\n transform.multiplyPoint3d(this.point01, this.point01);\r\n transform.multiplyPoint3d(this.point11, this.point11);\r\n return true;\r\n }\r\n /** Return a cloned and transformed patch. */\r\n public cloneTransformed(transform: Transform): BilinearPatch | undefined {\r\n const result = this.clone();\r\n result.tryTransformInPlace(transform);\r\n return result;\r\n }\r\n /** Extend a range by the range of the (optionally transformed) patch. */\r\n public extendRange(range: Range3d, transform?: Transform) {\r\n if (transform) {\r\n range.extendTransformedPoint(transform, this.point00);\r\n range.extendTransformedPoint(transform, this.point10);\r\n range.extendTransformedPoint(transform, this.point01);\r\n range.extendTransformedPoint(transform, this.point11);\r\n } else {\r\n range.extendPoint(this.point00);\r\n range.extendPoint(this.point10);\r\n range.extendPoint(this.point01);\r\n range.extendPoint(this.point11);\r\n }\r\n }\r\n /**\r\n * Convert fractional u and v coordinates to surface point\r\n * @param u fractional coordinate in u direction\r\n * @param v fractional coordinate in v direction\r\n * @param result optional pre-allocated point\r\n */\r\n public uvFractionToPoint(u: number, v: number, result?: Point3d): Point3d {\r\n const f00 = (1.0 - u) * (1.0 - v);\r\n const f10 = u * (1.0 - v);\r\n const f01 = (1.0 - u) * v;\r\n const f11 = u * v;\r\n return Point3d.create(\r\n f00 * this.point00.x + f10 * this.point10.x + f01 * this.point01.x + f11 * this.point11.x,\r\n f00 * this.point00.y + f10 * this.point10.y + f01 * this.point01.y + f11 * this.point11.y,\r\n f00 * this.point00.z + f10 * this.point10.z + f01 * this.point01.z + f11 * this.point11.z,\r\n result\r\n );\r\n }\r\n /** Evaluate as a uv surface, returning point and two derivative vectors.\r\n * @param u fractional coordinate in u direction\r\n * @param v fractional coordinate in v direction\r\n * @param result optional pre-allocated carrier for point and vectors\r\n */\r\n public uvFractionToPointAndTangents(u: number, v: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\r\n const u0 = 1.0 - u;\r\n const v0 = 1.0 - v;\r\n const f00 = u0 * v0;\r\n const f10 = u * v0;\r\n const f01 = u0 * v;\r\n const f11 = u * v;\r\n return Plane3dByOriginAndVectors.createOriginAndVectorsXYZ(\r\n f00 * this.point00.x + f10 * this.point10.x + f01 * this.point01.x + f11 * this.point11.x,\r\n f00 * this.point00.y + f10 * this.point10.y + f01 * this.point01.y + f11 * this.point11.y,\r\n f00 * this.point00.z + f10 * this.point10.z + f01 * this.point01.z + f11 * this.point11.z,\r\n // u derivative ..\r\n v0 * (this.point10.x - this.point00.x) + v * (this.point11.x - this.point01.x),\r\n v0 * (this.point10.y - this.point00.y) + v * (this.point11.y - this.point01.y),\r\n v0 * (this.point10.z - this.point00.z) + v * (this.point11.z - this.point01.z),\r\n // v derivative ..\r\n u0 * (this.point01.x - this.point00.x) + u * (this.point11.x - this.point10.x),\r\n u0 * (this.point01.y - this.point00.y) + u * (this.point11.y - this.point10.y),\r\n u0 * (this.point01.z - this.point00.z) + u * (this.point11.z - this.point10.z),\r\n result\r\n );\r\n }\r\n /** If data[iB][pivotColumn] is larger in absolute value than data[iA][pivotColumn], then swap rows iA and iB. */\r\n private static conditionalPivot(pivotColumn: number, data: Float64Array[], iA: number, iB: number) {\r\n if (Math.abs(data[iB][pivotColumn]) > Math.abs(data[iA][pivotColumn])) {\r\n const q = data[iA];\r\n data[iA] = data[iB];\r\n data[iB] = q;\r\n }\r\n }\r\n /**\r\n * Compute the points of intersection with a ray.\r\n * @param ray ray in space\r\n * @returns 1 or 2 points if there are intersections, undefined if no intersections\r\n */\r\n public intersectRay(ray: Ray3d): CurveAndSurfaceLocationDetail[] | undefined {\r\n const vectorU = this.point10.minus(this.point00);\r\n const vectorV = this.point01.minus(this.point00);\r\n const vectorW = this.point11.minus(this.point10);\r\n vectorW.subtractInPlace(vectorV);\r\n // We seek t, u, v such that:\r\n // `ray.origin + t*ray.direction = point00 + u*vectorU + v*vectorV + u*v*vectorW`\r\n // For typical direction as x, the scalar equation with coefficient order for arrays is:\r\n // `0 = -t*ray.direction.x + (point00.x - ray.origin.x) + u*vectorU.x + v*vectorV.x + u*v*vectorW.x`\r\n // and this particular equation is invoked to compute t when u and v are known.\r\n const coffs = [\r\n new Float64Array([-ray.direction.x, this.point00.x - ray.origin.x, vectorU.x, vectorV.x, vectorW.x]),\r\n new Float64Array([-ray.direction.y, this.point00.y - ray.origin.y, vectorU.y, vectorV.y, vectorW.y]),\r\n new Float64Array([-ray.direction.z, this.point00.z - ray.origin.z, vectorU.z, vectorV.z, vectorW.z]),\r\n ];\r\n // swap rows so that the equation with largest ray.direction coefficient is first.\r\n BilinearPatch.conditionalPivot(0, coffs, 0, 1);\r\n BilinearPatch.conditionalPivot(0, coffs, 0, 2);\r\n SmallSystem.eliminateFromPivot(coffs[0], 0, coffs[1], -1.0);\r\n SmallSystem.eliminateFromPivot(coffs[0], 0, coffs[2], -1.0);\r\n const uvArray = SmallSystem.solveBilinearPair(\r\n coffs[1][1], coffs[1][2], coffs[1][3], coffs[1][4],\r\n coffs[2][1], coffs[2][2], coffs[2][3], coffs[2][4]\r\n );\r\n if (uvArray) {\r\n const result: CurveAndSurfaceLocationDetail[] = [];\r\n for (const uv of uvArray) {\r\n const t = -(coffs[0][1] + coffs[0][2] * uv.x + (coffs[0][3] + coffs[0][4] * uv.x) * uv.y) / coffs[0][0];\r\n const point = ray.fractionToPoint(t);\r\n result.push(new CurveAndSurfaceLocationDetail(\r\n CurveLocationDetail.createRayFractionPoint(ray, t, point),\r\n UVSurfaceLocationDetail.createSurfaceUVPoint(this, uv, point))\r\n );\r\n }\r\n return result;\r\n }\r\n return undefined;\r\n }\r\n /** Returns the larger of the u-direction edge lengths at v=0 and v=1. */\r\n public maxUEdgeLength(): number {\r\n return Geometry.maxXY(this.point00.distance(this.point10), this.point01.distance(this.point11));\r\n }\r\n /** Returns the larger of the v-direction edge lengths at u=0 and u=1. */\r\n public maxVEdgeLength(): number {\r\n return Geometry.maxXY(this.point00.distance(this.point01), this.point10.distance(this.point11));\r\n }\r\n}\r\n"]}
@@ -328,7 +328,7 @@ export declare class GeodesicPathPoint {
328
328
  private static _vectorCross?;
329
329
  /** Evaluate the newton function and derivatives:
330
330
  * `(UAB cross UCB) dot d1cross`
331
- * with as the central data, UAB = vector from pointA to pointB, UCB = vector from pointC to pointA.
331
+ * with as the central data, UAB = vector from pointA to pointB, UCB = vector from pointC to pointB.
332
332
  * * Return order is:
333
333
  * * values[0] = the function
334
334
  * * values[1] = derivative wrt pointA.phi
@@ -876,7 +876,7 @@ export class GeodesicPathPoint {
876
876
  }
877
877
  /** Evaluate the newton function and derivatives:
878
878
  * `(UAB cross UCB) dot d1cross`
879
- * with as the central data, UAB = vector from pointA to pointB, UCB = vector from pointC to pointA.
879
+ * with as the central data, UAB = vector from pointA to pointB, UCB = vector from pointC to pointB.
880
880
  * * Return order is:
881
881
  * * values[0] = the function
882
882
  * * values[1] = derivative wrt pointA.phi