@kitware/vtk.js 20.1.2 → 20.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (309) hide show
  1. package/Common/Core/Base64.d.ts +14 -2
  2. package/Common/Core/Base64.js +31 -2
  3. package/Common/Core/Math/index.js +3 -3
  4. package/Common/Core/Math.d.ts +128 -128
  5. package/Common/Core/Math.js +1 -1
  6. package/Common/Core/MatrixBuilder.js +39 -41
  7. package/Common/DataModel/ImageData.js +12 -14
  8. package/Common/Transform/LandmarkTransform.js +6 -7
  9. package/Filters/General/PaintFilter/PaintFilter.worker.js +8 -8
  10. package/Filters/General/PaintFilter.js +11 -11
  11. package/Filters/Sources/PlaneSource.js +12 -13
  12. package/IO/Core/BinaryHelper.js +2 -4
  13. package/IO/Core/DataAccessHelper/HtmlDataAccessHelper.js +1 -1
  14. package/IO/Core/DataAccessHelper/HttpDataAccessHelper.js +1 -1
  15. package/IO/Core/DataAccessHelper/JSZipDataAccessHelper.js +2 -2
  16. package/IO/Core/ZipMultiDataSetReader.js +1 -1
  17. package/IO/Core/ZipMultiDataSetWriter.js +1 -1
  18. package/IO/Geometry/STLWriter.js +4 -4
  19. package/IO/Misc/SkyboxReader.js +1 -1
  20. package/IO/XML/XMLReader.js +3 -4
  21. package/IO/XML/XMLWriter.js +5 -6
  22. package/Imaging/Core/ImageReslice.js +18 -19
  23. package/Interaction/Manipulators/MouseCameraAxisRotateManipulator.js +27 -28
  24. package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.js +8 -9
  25. package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +14 -15
  26. package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +12 -13
  27. package/Interaction/Widgets/ImageCroppingRegionsWidget.js +5 -6
  28. package/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +1 -1
  29. package/Interaction/Widgets/PiecewiseGaussianWidget.js +2 -2
  30. package/Interaction/Widgets/ResliceCursor/ResliceCursorRepresentation.js +8 -9
  31. package/Rendering/Core/Actor.js +3 -4
  32. package/Rendering/Core/Camera.js +81 -84
  33. package/Rendering/Core/CellPicker.js +2 -2
  34. package/Rendering/Core/CubeAxesActor.js +32 -33
  35. package/Rendering/Core/Follower.js +20 -21
  36. package/Rendering/Core/Glyph3DMapper.js +30 -32
  37. package/Rendering/Core/ImageMapper.js +2 -2
  38. package/Rendering/Core/ImageSlice.js +5 -6
  39. package/Rendering/Core/Picker.js +5 -6
  40. package/Rendering/Core/PixelSpaceCallbackMapper.js +3 -4
  41. package/Rendering/Core/Prop3D.js +24 -25
  42. package/Rendering/Core/Renderer.js +11 -12
  43. package/Rendering/Core/ScalarBarActor.js +32 -33
  44. package/Rendering/Core/Volume.js +3 -4
  45. package/Rendering/OpenGL/Actor.js +9 -10
  46. package/Rendering/OpenGL/Camera.js +8 -9
  47. package/Rendering/OpenGL/CellArrayBufferObject.js +6 -8
  48. package/Rendering/OpenGL/Glyph3DMapper.js +8 -9
  49. package/Rendering/OpenGL/ImageMapper.js +7 -7
  50. package/Rendering/OpenGL/ImageSlice.js +4 -4
  51. package/Rendering/OpenGL/PolyDataMapper.js +11 -13
  52. package/Rendering/OpenGL/RenderWindow.d.ts +37 -1
  53. package/Rendering/OpenGL/ShaderCache.js +1 -1
  54. package/Rendering/OpenGL/Skybox.js +4 -5
  55. package/Rendering/OpenGL/SphereMapper.js +2 -2
  56. package/Rendering/OpenGL/StickMapper.js +3 -4
  57. package/Rendering/OpenGL/SurfaceLIC/SurfaceLICInterface.js +1 -1
  58. package/Rendering/OpenGL/Volume.js +6 -7
  59. package/Rendering/OpenGL/VolumeMapper.js +47 -49
  60. package/Rendering/OpenGL/glsl/vtkPolyDataFS.glsl.js +1 -1
  61. package/Rendering/WebGPU/Actor.js +8 -8
  62. package/Rendering/WebGPU/Camera.js +8 -8
  63. package/Rendering/WebGPU/ImageMapper.js +18 -19
  64. package/Rendering/WebGPU/ImageSlice.js +9 -9
  65. package/Rendering/WebGPU/PolyDataMapper.js +3 -4
  66. package/Rendering/WebGPU/Renderer.js +6 -7
  67. package/Rendering/WebGPU/Texture.js +10 -9
  68. package/Rendering/WebGPU/Volume.js +3 -3
  69. package/Rendering/WebGPU/VolumePassFSQ.js +10 -10
  70. package/ThirdParty/index.js +2 -2
  71. package/Widgets/Manipulators/TrackballManipulator.js +5 -6
  72. package/Widgets/Representations/ArrowHandleRepresentation.js +10 -12
  73. package/Widgets/Representations/CircleContextRepresentation.js +4 -5
  74. package/Widgets/Representations/RectangleContextRepresentation.js +3 -3
  75. package/Widgets/Widgets3D/EllipseWidget/behavior.js +5 -5
  76. package/Widgets/Widgets3D/ImageCroppingWidget/helpers.js +6 -8
  77. package/Widgets/Widgets3D/PaintWidget/behavior.js +2 -2
  78. package/Widgets/Widgets3D/ResliceCursorWidget.js +6 -7
  79. package/Widgets/Widgets3D/ShapeWidget/behavior.js +10 -10
  80. package/Widgets/Widgets3D/SplineWidget/behavior.js +5 -5
  81. package/_virtual/rollup-plugin-worker-loader__module_Sources/Filters/General/PaintFilter/PaintFilter.worker.js +1 -1
  82. package/_virtual/rollup-plugin-worker-loader__module_Sources/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +1 -1
  83. package/package.json +2 -2
  84. package/vtk.js +2 -2
  85. package/_vendor/base64-js/index.js_commonjs-exports.js +0 -1
  86. package/_vendor/blueimp-md5/js/md5.js_commonjs-module.js +0 -3
  87. package/_vendor/define-properties/index.js_commonjs-proxy.js +0 -1
  88. package/_vendor/globalthis/implementation.browser.js_commonjs-module.js +0 -3
  89. package/_vendor/globalthis/implementation.browser.js_commonjs-proxy.js +0 -1
  90. package/_vendor/globalthis/polyfill.js_commonjs-proxy.js +0 -1
  91. package/_vendor/globalthis/shim.js_commonjs-proxy.js +0 -2
  92. package/_vendor/jszip/dist/jszip.min.js_commonjs-module.js +0 -3
  93. package/_vendor/object-keys/implementation.js_commonjs-proxy.js +0 -1
  94. package/_vendor/object-keys/index.js_commonjs-proxy.js +0 -1
  95. package/_vendor/object-keys/isArguments.js_commonjs-proxy.js +0 -1
  96. package/_vendor/seedrandom/lib/alea.js_commonjs-module.js +0 -3
  97. package/_vendor/seedrandom/lib/alea.js_commonjs-proxy.js +0 -1
  98. package/_vendor/seedrandom/lib/tychei.js_commonjs-module.js +0 -3
  99. package/_vendor/seedrandom/lib/tychei.js_commonjs-proxy.js +0 -1
  100. package/_vendor/seedrandom/lib/xor128.js_commonjs-module.js +0 -3
  101. package/_vendor/seedrandom/lib/xor128.js_commonjs-proxy.js +0 -1
  102. package/_vendor/seedrandom/lib/xor4096.js_commonjs-module.js +0 -3
  103. package/_vendor/seedrandom/lib/xor4096.js_commonjs-proxy.js +0 -1
  104. package/_vendor/seedrandom/lib/xorshift7.js_commonjs-module.js +0 -3
  105. package/_vendor/seedrandom/lib/xorshift7.js_commonjs-proxy.js +0 -1
  106. package/_vendor/seedrandom/lib/xorwow.js_commonjs-module.js +0 -3
  107. package/_vendor/seedrandom/lib/xorwow.js_commonjs-proxy.js +0 -1
  108. package/_vendor/seedrandom/seedrandom.js_commonjs-module.js +0 -3
  109. package/_vendor/seedrandom/seedrandom.js_commonjs-proxy.js +0 -1
  110. package/_vendor/webworker-promise/lib/register.js_commonjs-module.js +0 -3
  111. package/_vendor/webworker-promise/lib/tiny-emitter.js_commonjs-proxy.js +0 -1
  112. package/_vendor/webworker-promise/src/tiny-emitter.js_commonjs-proxy.js +0 -1
  113. package/_vendor/xmlbuilder2/lib/xmlbuilder2.min.js_commonjs-module.js +0 -3
  114. package/_virtual/_rollup_plugin_ignore_empty_module_placeholder_commonjs-proxy.js +0 -6
  115. package/_virtual/commonjsHelpers.js +0 -22
  116. package/_virtual/polyfill-node.buffer.js +0 -1971
  117. package/_virtual/polyfill-node.global.js +0 -5
  118. package/_virtual/rollup_plugin_ignore_empty_module_placeholder.js +0 -8
  119. package/vendor/base64-js/index.js +0 -72
  120. package/vendor/blueimp-md5/js/md5.js +0 -402
  121. package/vendor/d3-array/src/array.js +0 -1
  122. package/vendor/d3-array/src/ascending.js +0 -5
  123. package/vendor/d3-array/src/bin.js +0 -1
  124. package/vendor/d3-array/src/bisect.js +0 -10
  125. package/vendor/d3-array/src/bisector.js +0 -46
  126. package/vendor/d3-array/src/constant.js +0 -1
  127. package/vendor/d3-array/src/count.js +0 -1
  128. package/vendor/d3-array/src/cross.js +0 -1
  129. package/vendor/d3-array/src/cumsum.js +0 -1
  130. package/vendor/d3-array/src/descending.js +0 -1
  131. package/vendor/d3-array/src/deviation.js +0 -1
  132. package/vendor/d3-array/src/difference.js +0 -1
  133. package/vendor/d3-array/src/disjoint.js +0 -1
  134. package/vendor/d3-array/src/every.js +0 -1
  135. package/vendor/d3-array/src/extent.js +0 -1
  136. package/vendor/d3-array/src/filter.js +0 -1
  137. package/vendor/d3-array/src/fsum.js +0 -1
  138. package/vendor/d3-array/src/greatest.js +0 -1
  139. package/vendor/d3-array/src/greatestIndex.js +0 -1
  140. package/vendor/d3-array/src/group.js +0 -1
  141. package/vendor/d3-array/src/groupSort.js +0 -1
  142. package/vendor/d3-array/src/identity.js +0 -1
  143. package/vendor/d3-array/src/index.js +0 -1
  144. package/vendor/d3-array/src/intersection.js +0 -1
  145. package/vendor/d3-array/src/least.js +0 -1
  146. package/vendor/d3-array/src/leastIndex.js +0 -1
  147. package/vendor/d3-array/src/map.js +0 -1
  148. package/vendor/d3-array/src/max.js +0 -1
  149. package/vendor/d3-array/src/maxIndex.js +0 -1
  150. package/vendor/d3-array/src/mean.js +0 -1
  151. package/vendor/d3-array/src/median.js +0 -1
  152. package/vendor/d3-array/src/merge.js +0 -1
  153. package/vendor/d3-array/src/min.js +0 -1
  154. package/vendor/d3-array/src/minIndex.js +0 -1
  155. package/vendor/d3-array/src/mode.js +0 -1
  156. package/vendor/d3-array/src/nice.js +0 -1
  157. package/vendor/d3-array/src/number.js +0 -5
  158. package/vendor/d3-array/src/pairs.js +0 -1
  159. package/vendor/d3-array/src/permute.js +0 -1
  160. package/vendor/d3-array/src/quantile.js +0 -1
  161. package/vendor/d3-array/src/quickselect.js +0 -1
  162. package/vendor/d3-array/src/range.js +0 -1
  163. package/vendor/d3-array/src/reduce.js +0 -1
  164. package/vendor/d3-array/src/reverse.js +0 -1
  165. package/vendor/d3-array/src/scan.js +0 -1
  166. package/vendor/d3-array/src/set.js +0 -1
  167. package/vendor/d3-array/src/shuffle.js +0 -1
  168. package/vendor/d3-array/src/some.js +0 -1
  169. package/vendor/d3-array/src/sort.js +0 -1
  170. package/vendor/d3-array/src/subset.js +0 -1
  171. package/vendor/d3-array/src/sum.js +0 -1
  172. package/vendor/d3-array/src/superset.js +0 -1
  173. package/vendor/d3-array/src/threshold/freedmanDiaconis.js +0 -1
  174. package/vendor/d3-array/src/threshold/scott.js +0 -1
  175. package/vendor/d3-array/src/threshold/sturges.js +0 -1
  176. package/vendor/d3-array/src/ticks.js +0 -56
  177. package/vendor/d3-array/src/transpose.js +0 -1
  178. package/vendor/d3-array/src/union.js +0 -1
  179. package/vendor/d3-array/src/variance.js +0 -1
  180. package/vendor/d3-array/src/zip.js +0 -1
  181. package/vendor/d3-color/src/color.js +0 -373
  182. package/vendor/d3-color/src/cubehelix.js +0 -1
  183. package/vendor/d3-color/src/define.js +0 -12
  184. package/vendor/d3-color/src/index.js +0 -1
  185. package/vendor/d3-color/src/lab.js +0 -1
  186. package/vendor/d3-color/src/math.js +0 -1
  187. package/vendor/d3-format/src/defaultLocale.js +0 -20
  188. package/vendor/d3-format/src/exponent.js +0 -7
  189. package/vendor/d3-format/src/formatDecimal.js +0 -22
  190. package/vendor/d3-format/src/formatGroup.js +0 -20
  191. package/vendor/d3-format/src/formatNumerals.js +0 -9
  192. package/vendor/d3-format/src/formatPrefixAuto.js +0 -18
  193. package/vendor/d3-format/src/formatRounded.js +0 -13
  194. package/vendor/d3-format/src/formatSpecifier.js +0 -49
  195. package/vendor/d3-format/src/formatTrim.js +0 -13
  196. package/vendor/d3-format/src/formatTypes.js +0 -21
  197. package/vendor/d3-format/src/identity.js +0 -5
  198. package/vendor/d3-format/src/index.js +0 -1
  199. package/vendor/d3-format/src/locale.js +0 -150
  200. package/vendor/d3-format/src/precisionFixed.js +0 -7
  201. package/vendor/d3-format/src/precisionPrefix.js +0 -7
  202. package/vendor/d3-format/src/precisionRound.js +0 -8
  203. package/vendor/d3-interpolate/src/array.js +0 -19
  204. package/vendor/d3-interpolate/src/basis.js +0 -1
  205. package/vendor/d3-interpolate/src/basisClosed.js +0 -1
  206. package/vendor/d3-interpolate/src/color.js +0 -26
  207. package/vendor/d3-interpolate/src/constant.js +0 -3
  208. package/vendor/d3-interpolate/src/cubehelix.js +0 -1
  209. package/vendor/d3-interpolate/src/date.js +0 -8
  210. package/vendor/d3-interpolate/src/discrete.js +0 -1
  211. package/vendor/d3-interpolate/src/hcl.js +0 -1
  212. package/vendor/d3-interpolate/src/hsl.js +0 -1
  213. package/vendor/d3-interpolate/src/hue.js +0 -1
  214. package/vendor/d3-interpolate/src/index.js +0 -1
  215. package/vendor/d3-interpolate/src/lab.js +0 -1
  216. package/vendor/d3-interpolate/src/number.js +0 -7
  217. package/vendor/d3-interpolate/src/numberArray.js +0 -16
  218. package/vendor/d3-interpolate/src/object.js +0 -25
  219. package/vendor/d3-interpolate/src/piecewise.js +0 -1
  220. package/vendor/d3-interpolate/src/quantize.js +0 -1
  221. package/vendor/d3-interpolate/src/rgb.js +0 -26
  222. package/vendor/d3-interpolate/src/round.js +0 -7
  223. package/vendor/d3-interpolate/src/string.js +0 -66
  224. package/vendor/d3-interpolate/src/transform/decompose.js +0 -1
  225. package/vendor/d3-interpolate/src/transform/index.js +0 -1
  226. package/vendor/d3-interpolate/src/transform/parse.js +0 -1
  227. package/vendor/d3-interpolate/src/value.js +0 -24
  228. package/vendor/d3-interpolate/src/zoom.js +0 -1
  229. package/vendor/d3-scale/src/band.js +0 -1
  230. package/vendor/d3-scale/src/constant.js +0 -7
  231. package/vendor/d3-scale/src/continuous.js +0 -129
  232. package/vendor/d3-scale/src/diverging.js +0 -1
  233. package/vendor/d3-scale/src/identity.js +0 -1
  234. package/vendor/d3-scale/src/index.js +0 -1
  235. package/vendor/d3-scale/src/init.js +0 -10
  236. package/vendor/d3-scale/src/linear.js +0 -72
  237. package/vendor/d3-scale/src/log.js +0 -1
  238. package/vendor/d3-scale/src/nice.js +0 -1
  239. package/vendor/d3-scale/src/number.js +0 -5
  240. package/vendor/d3-scale/src/ordinal.js +0 -1
  241. package/vendor/d3-scale/src/pow.js +0 -1
  242. package/vendor/d3-scale/src/quantile.js +0 -1
  243. package/vendor/d3-scale/src/quantize.js +0 -1
  244. package/vendor/d3-scale/src/radial.js +0 -1
  245. package/vendor/d3-scale/src/sequential.js +0 -1
  246. package/vendor/d3-scale/src/sequentialQuantile.js +0 -1
  247. package/vendor/d3-scale/src/symlog.js +0 -1
  248. package/vendor/d3-scale/src/threshold.js +0 -1
  249. package/vendor/d3-scale/src/tickFormat.js +0 -35
  250. package/vendor/d3-scale/src/time.js +0 -1
  251. package/vendor/d3-scale/src/utcTime.js +0 -1
  252. package/vendor/d3-time/src/day.js +0 -1
  253. package/vendor/d3-time/src/duration.js +0 -1
  254. package/vendor/d3-time/src/hour.js +0 -1
  255. package/vendor/d3-time/src/index.js +0 -1
  256. package/vendor/d3-time/src/interval.js +0 -1
  257. package/vendor/d3-time/src/millisecond.js +0 -1
  258. package/vendor/d3-time/src/minute.js +0 -1
  259. package/vendor/d3-time/src/month.js +0 -1
  260. package/vendor/d3-time/src/second.js +0 -1
  261. package/vendor/d3-time/src/ticks.js +0 -1
  262. package/vendor/d3-time/src/utcDay.js +0 -1
  263. package/vendor/d3-time/src/utcHour.js +0 -1
  264. package/vendor/d3-time/src/utcMinute.js +0 -1
  265. package/vendor/d3-time/src/utcMonth.js +0 -1
  266. package/vendor/d3-time/src/utcWeek.js +0 -1
  267. package/vendor/d3-time/src/utcYear.js +0 -1
  268. package/vendor/d3-time/src/week.js +0 -1
  269. package/vendor/d3-time/src/year.js +0 -1
  270. package/vendor/d3-time-format/src/defaultLocale.js +0 -1
  271. package/vendor/d3-time-format/src/index.js +0 -1
  272. package/vendor/d3-time-format/src/isoFormat.js +0 -1
  273. package/vendor/d3-time-format/src/isoParse.js +0 -1
  274. package/vendor/d3-time-format/src/locale.js +0 -1
  275. package/vendor/define-properties/index.js +0 -60
  276. package/vendor/gl-matrix/esm/common.js +0 -30
  277. package/vendor/gl-matrix/esm/index.js +0 -1
  278. package/vendor/gl-matrix/esm/mat2.js +0 -1
  279. package/vendor/gl-matrix/esm/mat2d.js +0 -1
  280. package/vendor/gl-matrix/esm/mat3.js +0 -817
  281. package/vendor/gl-matrix/esm/mat4.js +0 -1868
  282. package/vendor/gl-matrix/esm/quat.js +0 -330
  283. package/vendor/gl-matrix/esm/quat2.js +0 -1
  284. package/vendor/gl-matrix/esm/vec2.js +0 -1
  285. package/vendor/gl-matrix/esm/vec3.js +0 -842
  286. package/vendor/gl-matrix/esm/vec4.js +0 -153
  287. package/vendor/globalthis/implementation.browser.js +0 -11
  288. package/vendor/globalthis/index.js +0 -25
  289. package/vendor/globalthis/polyfill.js +0 -14
  290. package/vendor/globalthis/shim.js +0 -25
  291. package/vendor/internmap/src/index.js +0 -1
  292. package/vendor/jszip/dist/jszip.min.js +0 -11
  293. package/vendor/object-keys/implementation.js +0 -124
  294. package/vendor/object-keys/index.js +0 -35
  295. package/vendor/object-keys/isArguments.js +0 -17
  296. package/vendor/pako/dist/pako.esm.mjs.js +0 -6707
  297. package/vendor/seedrandom/index.js +0 -77
  298. package/vendor/seedrandom/lib/alea.js +0 -117
  299. package/vendor/seedrandom/lib/tychei.js +0 -105
  300. package/vendor/seedrandom/lib/xor128.js +0 -84
  301. package/vendor/seedrandom/lib/xor4096.js +0 -150
  302. package/vendor/seedrandom/lib/xorshift7.js +0 -101
  303. package/vendor/seedrandom/lib/xorwow.js +0 -89
  304. package/vendor/seedrandom/seedrandom.js +0 -256
  305. package/vendor/webworker-promise/lib/register.js +0 -158
  306. package/vendor/webworker-promise/lib/tiny-emitter.js +0 -89
  307. package/vendor/webworker-promise/src/index.js +0 -110
  308. package/vendor/webworker-promise/src/tiny-emitter.js +0 -51
  309. package/vendor/xmlbuilder2/lib/xmlbuilder2.min.js +0 -13
@@ -1,330 +0,0 @@
1
- import { A as ARRAY_TYPE, E as EPSILON } from './common.js';
2
- import { c as create$2 } from './mat3.js';
3
- import { u as create$1, y as fromValues$1, d as dot, c as cross, r as len, n as normalize$1 } from './vec3.js';
4
- import { f as fromValues$2, n as normalize$2 } from './vec4.js';
5
-
6
- /**
7
- * Quaternion
8
- * @module quat
9
- */
10
-
11
- /**
12
- * Creates a new identity quat
13
- *
14
- * @returns {quat} a new quaternion
15
- */
16
-
17
- function create() {
18
- var out = new ARRAY_TYPE(4);
19
-
20
- if (ARRAY_TYPE != Float32Array) {
21
- out[0] = 0;
22
- out[1] = 0;
23
- out[2] = 0;
24
- }
25
-
26
- out[3] = 1;
27
- return out;
28
- }
29
- /**
30
- * Sets a quat from the given angle and rotation axis,
31
- * then returns it.
32
- *
33
- * @param {quat} out the receiving quaternion
34
- * @param {ReadonlyVec3} axis the axis around which to rotate
35
- * @param {Number} rad the angle in radians
36
- * @returns {quat} out
37
- **/
38
-
39
- function setAxisAngle(out, axis, rad) {
40
- rad = rad * 0.5;
41
- var s = Math.sin(rad);
42
- out[0] = s * axis[0];
43
- out[1] = s * axis[1];
44
- out[2] = s * axis[2];
45
- out[3] = Math.cos(rad);
46
- return out;
47
- }
48
- /**
49
- * Gets the rotation axis and angle for a given
50
- * quaternion. If a quaternion is created with
51
- * setAxisAngle, this method will return the same
52
- * values as providied in the original parameter list
53
- * OR functionally equivalent values.
54
- * Example: The quaternion formed by axis [0, 0, 1] and
55
- * angle -90 is the same as the quaternion formed by
56
- * [0, 0, 1] and 270. This method favors the latter.
57
- * @param {vec3} out_axis Vector receiving the axis of rotation
58
- * @param {ReadonlyQuat} q Quaternion to be decomposed
59
- * @return {Number} Angle, in radians, of the rotation
60
- */
61
-
62
- function getAxisAngle(out_axis, q) {
63
- var rad = Math.acos(q[3]) * 2.0;
64
- var s = Math.sin(rad / 2.0);
65
-
66
- if (s > EPSILON) {
67
- out_axis[0] = q[0] / s;
68
- out_axis[1] = q[1] / s;
69
- out_axis[2] = q[2] / s;
70
- } else {
71
- // If s is zero, return any axis (no rotation - axis does not matter)
72
- out_axis[0] = 1;
73
- out_axis[1] = 0;
74
- out_axis[2] = 0;
75
- }
76
-
77
- return rad;
78
- }
79
- /**
80
- * Multiplies two quat's
81
- *
82
- * @param {quat} out the receiving quaternion
83
- * @param {ReadonlyQuat} a the first operand
84
- * @param {ReadonlyQuat} b the second operand
85
- * @returns {quat} out
86
- */
87
-
88
- function multiply(out, a, b) {
89
- var ax = a[0],
90
- ay = a[1],
91
- az = a[2],
92
- aw = a[3];
93
- var bx = b[0],
94
- by = b[1],
95
- bz = b[2],
96
- bw = b[3];
97
- out[0] = ax * bw + aw * bx + ay * bz - az * by;
98
- out[1] = ay * bw + aw * by + az * bx - ax * bz;
99
- out[2] = az * bw + aw * bz + ax * by - ay * bx;
100
- out[3] = aw * bw - ax * bx - ay * by - az * bz;
101
- return out;
102
- }
103
- /**
104
- * Performs a spherical linear interpolation between two quat
105
- *
106
- * @param {quat} out the receiving quaternion
107
- * @param {ReadonlyQuat} a the first operand
108
- * @param {ReadonlyQuat} b the second operand
109
- * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
110
- * @returns {quat} out
111
- */
112
-
113
- function slerp(out, a, b, t) {
114
- // benchmarks:
115
- // http://jsperf.com/quaternion-slerp-implementations
116
- var ax = a[0],
117
- ay = a[1],
118
- az = a[2],
119
- aw = a[3];
120
- var bx = b[0],
121
- by = b[1],
122
- bz = b[2],
123
- bw = b[3];
124
- var omega, cosom, sinom, scale0, scale1; // calc cosine
125
-
126
- cosom = ax * bx + ay * by + az * bz + aw * bw; // adjust signs (if necessary)
127
-
128
- if (cosom < 0.0) {
129
- cosom = -cosom;
130
- bx = -bx;
131
- by = -by;
132
- bz = -bz;
133
- bw = -bw;
134
- } // calculate coefficients
135
-
136
-
137
- if (1.0 - cosom > EPSILON) {
138
- // standard case (slerp)
139
- omega = Math.acos(cosom);
140
- sinom = Math.sin(omega);
141
- scale0 = Math.sin((1.0 - t) * omega) / sinom;
142
- scale1 = Math.sin(t * omega) / sinom;
143
- } else {
144
- // "from" and "to" quaternions are very close
145
- // ... so we can do a linear interpolation
146
- scale0 = 1.0 - t;
147
- scale1 = t;
148
- } // calculate final values
149
-
150
-
151
- out[0] = scale0 * ax + scale1 * bx;
152
- out[1] = scale0 * ay + scale1 * by;
153
- out[2] = scale0 * az + scale1 * bz;
154
- out[3] = scale0 * aw + scale1 * bw;
155
- return out;
156
- }
157
- /**
158
- * Calculates the conjugate of a quat
159
- * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.
160
- *
161
- * @param {quat} out the receiving quaternion
162
- * @param {ReadonlyQuat} a quat to calculate conjugate of
163
- * @returns {quat} out
164
- */
165
-
166
- function conjugate(out, a) {
167
- out[0] = -a[0];
168
- out[1] = -a[1];
169
- out[2] = -a[2];
170
- out[3] = a[3];
171
- return out;
172
- }
173
- /**
174
- * Creates a quaternion from the given 3x3 rotation matrix.
175
- *
176
- * NOTE: The resultant quaternion is not normalized, so you should be sure
177
- * to renormalize the quaternion yourself where necessary.
178
- *
179
- * @param {quat} out the receiving quaternion
180
- * @param {ReadonlyMat3} m rotation matrix
181
- * @returns {quat} out
182
- * @function
183
- */
184
-
185
- function fromMat3(out, m) {
186
- // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes
187
- // article "Quaternion Calculus and Fast Animation".
188
- var fTrace = m[0] + m[4] + m[8];
189
- var fRoot;
190
-
191
- if (fTrace > 0.0) {
192
- // |w| > 1/2, may as well choose w > 1/2
193
- fRoot = Math.sqrt(fTrace + 1.0); // 2w
194
-
195
- out[3] = 0.5 * fRoot;
196
- fRoot = 0.5 / fRoot; // 1/(4w)
197
-
198
- out[0] = (m[5] - m[7]) * fRoot;
199
- out[1] = (m[6] - m[2]) * fRoot;
200
- out[2] = (m[1] - m[3]) * fRoot;
201
- } else {
202
- // |w| <= 1/2
203
- var i = 0;
204
- if (m[4] > m[0]) i = 1;
205
- if (m[8] > m[i * 3 + i]) i = 2;
206
- var j = (i + 1) % 3;
207
- var k = (i + 2) % 3;
208
- fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);
209
- out[i] = 0.5 * fRoot;
210
- fRoot = 0.5 / fRoot;
211
- out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;
212
- out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;
213
- out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;
214
- }
215
-
216
- return out;
217
- }
218
- /**
219
- * Creates a new quat initialized with the given values
220
- *
221
- * @param {Number} x X component
222
- * @param {Number} y Y component
223
- * @param {Number} z Z component
224
- * @param {Number} w W component
225
- * @returns {quat} a new quaternion
226
- * @function
227
- */
228
-
229
- var fromValues = fromValues$2;
230
- /**
231
- * Normalize a quat
232
- *
233
- * @param {quat} out the receiving quaternion
234
- * @param {ReadonlyQuat} a quaternion to normalize
235
- * @returns {quat} out
236
- * @function
237
- */
238
-
239
- var normalize = normalize$2;
240
- /**
241
- * Sets a quaternion to represent the shortest rotation from one
242
- * vector to another.
243
- *
244
- * Both vectors are assumed to be unit length.
245
- *
246
- * @param {quat} out the receiving quaternion.
247
- * @param {ReadonlyVec3} a the initial vector
248
- * @param {ReadonlyVec3} b the destination vector
249
- * @returns {quat} out
250
- */
251
-
252
- (function () {
253
- var tmpvec3 = create$1();
254
- var xUnitVec3 = fromValues$1(1, 0, 0);
255
- var yUnitVec3 = fromValues$1(0, 1, 0);
256
- return function (out, a, b) {
257
- var dot$1 = dot(a, b);
258
-
259
- if (dot$1 < -0.999999) {
260
- cross(tmpvec3, xUnitVec3, a);
261
- if (len(tmpvec3) < 0.000001) cross(tmpvec3, yUnitVec3, a);
262
- normalize$1(tmpvec3, tmpvec3);
263
- setAxisAngle(out, tmpvec3, Math.PI);
264
- return out;
265
- } else if (dot$1 > 0.999999) {
266
- out[0] = 0;
267
- out[1] = 0;
268
- out[2] = 0;
269
- out[3] = 1;
270
- return out;
271
- } else {
272
- cross(tmpvec3, a, b);
273
- out[0] = tmpvec3[0];
274
- out[1] = tmpvec3[1];
275
- out[2] = tmpvec3[2];
276
- out[3] = 1 + dot$1;
277
- return normalize(out, out);
278
- }
279
- };
280
- })();
281
- /**
282
- * Performs a spherical linear interpolation with two control points
283
- *
284
- * @param {quat} out the receiving quaternion
285
- * @param {ReadonlyQuat} a the first operand
286
- * @param {ReadonlyQuat} b the second operand
287
- * @param {ReadonlyQuat} c the third operand
288
- * @param {ReadonlyQuat} d the fourth operand
289
- * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
290
- * @returns {quat} out
291
- */
292
-
293
- (function () {
294
- var temp1 = create();
295
- var temp2 = create();
296
- return function (out, a, b, c, d, t) {
297
- slerp(temp1, a, d, t);
298
- slerp(temp2, b, c, t);
299
- slerp(out, temp1, temp2, 2 * t * (1 - t));
300
- return out;
301
- };
302
- })();
303
- /**
304
- * Sets the specified quaternion with values corresponding to the given
305
- * axes. Each axis is a vec3 and is expected to be unit length and
306
- * perpendicular to all other specified axes.
307
- *
308
- * @param {ReadonlyVec3} view the vector representing the viewing direction
309
- * @param {ReadonlyVec3} right the vector representing the local "right" direction
310
- * @param {ReadonlyVec3} up the vector representing the local "up" direction
311
- * @returns {quat} out
312
- */
313
-
314
- (function () {
315
- var matr = create$2();
316
- return function (out, view, right, up) {
317
- matr[0] = right[0];
318
- matr[3] = right[1];
319
- matr[6] = right[2];
320
- matr[1] = up[0];
321
- matr[4] = up[1];
322
- matr[7] = up[2];
323
- matr[2] = -view[0];
324
- matr[5] = -view[1];
325
- matr[8] = -view[2];
326
- return normalize(out, fromMat3(out, matr));
327
- };
328
- })();
329
-
330
- export { conjugate as a, create as c, fromValues as f, getAxisAngle as g, multiply as m, setAxisAngle as s };
@@ -1 +0,0 @@
1
-
@@ -1 +0,0 @@
1
-