@kitware/vtk.js 20.1.4 → 20.2.3
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.
- package/Common/Core/Base64.d.ts +14 -2
- package/Common/Core/Base64.js +31 -2
- package/Common/Core/Math/index.js +1 -1
- package/Common/Core/Math.d.ts +168 -158
- package/Common/Core/Math.js +1 -1
- package/Common/Core/MatrixBuilder.js +39 -41
- package/Common/DataModel/Box.d.ts +73 -0
- package/Common/DataModel/ImageData.js +12 -14
- package/Common/Transform/LandmarkTransform.js +6 -7
- package/Filters/General/PaintFilter/PaintFilter.worker.js +8 -8
- package/Filters/General/PaintFilter.js +11 -11
- package/Filters/Sources/CubeSource.d.ts +7 -6
- package/Filters/Sources/PlaneSource.js +12 -13
- package/IO/Core/BinaryHelper.js +2 -4
- package/IO/Core/DataAccessHelper/HtmlDataAccessHelper.js +1 -1
- package/IO/Core/DataAccessHelper/HttpDataAccessHelper.js +1 -1
- package/IO/Core/DataAccessHelper/JSZipDataAccessHelper.js +2 -2
- package/IO/Core/ZipMultiDataSetReader.js +1 -1
- package/IO/Core/ZipMultiDataSetWriter.js +1 -1
- package/IO/Geometry/STLWriter.js +4 -4
- package/IO/Misc/OBJReader.d.ts +9 -8
- package/IO/Misc/SkyboxReader.js +1 -1
- package/IO/XML/XMLReader.js +3 -4
- package/IO/XML/XMLWriter.js +5 -6
- package/Imaging/Core/ImageReslice.js +18 -19
- package/Interaction/Manipulators/MouseCameraAxisRotateManipulator.js +27 -28
- package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.js +8 -9
- package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +14 -15
- package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +12 -13
- package/Interaction/Widgets/ImageCroppingRegionsWidget.js +5 -6
- package/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +1 -1
- package/Interaction/Widgets/PiecewiseGaussianWidget.js +2 -2
- package/Interaction/Widgets/ResliceCursor/ResliceCursorRepresentation.js +8 -9
- package/Rendering/Core/Actor.js +3 -4
- package/Rendering/Core/AnnotatedCubeActor.d.ts +5 -6
- package/Rendering/Core/Camera.js +81 -84
- package/Rendering/Core/CellPicker.js +2 -2
- package/Rendering/Core/CubeAxesActor.js +37 -34
- package/Rendering/Core/Follower.js +20 -21
- package/Rendering/Core/Glyph3DMapper.js +30 -32
- package/Rendering/Core/ImageMapper.js +2 -2
- package/Rendering/Core/ImageSlice.js +5 -6
- package/Rendering/Core/Picker.d.ts +5 -5
- package/Rendering/Core/Picker.js +5 -6
- package/Rendering/Core/PixelSpaceCallbackMapper.js +3 -4
- package/Rendering/Core/Prop3D.js +24 -25
- package/Rendering/Core/Renderer.js +11 -12
- package/Rendering/Core/ScalarBarActor.js +37 -34
- package/Rendering/Core/Volume.js +3 -4
- package/Rendering/OpenGL/Actor.js +9 -10
- package/Rendering/OpenGL/Camera.js +8 -9
- package/Rendering/OpenGL/CellArrayBufferObject.js +6 -8
- package/Rendering/OpenGL/Glyph3DMapper.js +8 -9
- package/Rendering/OpenGL/ImageMapper.js +7 -7
- package/Rendering/OpenGL/ImageSlice.js +4 -4
- package/Rendering/OpenGL/PolyDataMapper.js +11 -13
- package/Rendering/OpenGL/RenderWindow.d.ts +21 -35
- package/Rendering/OpenGL/ShaderCache.js +1 -1
- package/Rendering/OpenGL/Skybox.js +4 -5
- package/Rendering/OpenGL/SphereMapper.js +2 -2
- package/Rendering/OpenGL/StickMapper.js +3 -4
- package/Rendering/OpenGL/SurfaceLIC/SurfaceLICInterface.js +1 -1
- package/Rendering/OpenGL/Volume.js +6 -7
- package/Rendering/OpenGL/VolumeMapper.js +47 -49
- package/Rendering/OpenGL/glsl/vtkPolyDataFS.glsl.js +1 -1
- package/Rendering/WebGPU/Actor.js +8 -8
- package/Rendering/WebGPU/Camera.js +8 -8
- package/Rendering/WebGPU/ImageMapper.js +18 -19
- package/Rendering/WebGPU/ImageSlice.js +9 -9
- package/Rendering/WebGPU/PolyDataMapper.js +3 -4
- package/Rendering/WebGPU/Renderer.js +6 -7
- package/Rendering/WebGPU/Volume.js +3 -3
- package/Rendering/WebGPU/VolumePassFSQ.js +10 -10
- package/ThirdParty/index.js +2 -2
- package/Widgets/Manipulators/TrackballManipulator.js +5 -6
- package/Widgets/Representations/ArrowHandleRepresentation.js +10 -12
- package/Widgets/Representations/CircleContextRepresentation.js +4 -5
- package/Widgets/Representations/RectangleContextRepresentation.js +3 -3
- package/Widgets/Widgets3D/EllipseWidget/behavior.js +5 -5
- package/Widgets/Widgets3D/ImageCroppingWidget/helpers.js +6 -8
- package/Widgets/Widgets3D/PaintWidget/behavior.js +2 -2
- package/Widgets/Widgets3D/ResliceCursorWidget.js +6 -7
- package/Widgets/Widgets3D/ShapeWidget/behavior.js +10 -10
- package/Widgets/Widgets3D/SplineWidget/behavior.js +5 -5
- package/_virtual/rollup-plugin-worker-loader__module_Sources/Filters/General/PaintFilter/PaintFilter.worker.js +1 -1
- package/_virtual/rollup-plugin-worker-loader__module_Sources/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +1 -1
- package/package.json +2 -2
- package/types.d.ts +1 -0
- package/vtk.js +2 -2
- package/_vendor/base64-js/index.js_commonjs-exports.js +0 -1
- package/_vendor/blueimp-md5/js/md5.js_commonjs-module.js +0 -3
- package/_vendor/define-properties/index.js_commonjs-proxy.js +0 -1
- package/_vendor/globalthis/implementation.browser.js_commonjs-module.js +0 -3
- package/_vendor/globalthis/implementation.browser.js_commonjs-proxy.js +0 -1
- package/_vendor/globalthis/polyfill.js_commonjs-proxy.js +0 -1
- package/_vendor/globalthis/shim.js_commonjs-proxy.js +0 -2
- package/_vendor/jszip/dist/jszip.min.js_commonjs-module.js +0 -3
- package/_vendor/object-keys/implementation.js_commonjs-proxy.js +0 -1
- package/_vendor/object-keys/index.js_commonjs-proxy.js +0 -1
- package/_vendor/object-keys/isArguments.js_commonjs-proxy.js +0 -1
- package/_vendor/seedrandom/lib/alea.js_commonjs-module.js +0 -3
- package/_vendor/seedrandom/lib/alea.js_commonjs-proxy.js +0 -1
- package/_vendor/seedrandom/lib/tychei.js_commonjs-module.js +0 -3
- package/_vendor/seedrandom/lib/tychei.js_commonjs-proxy.js +0 -1
- package/_vendor/seedrandom/lib/xor128.js_commonjs-module.js +0 -3
- package/_vendor/seedrandom/lib/xor128.js_commonjs-proxy.js +0 -1
- package/_vendor/seedrandom/lib/xor4096.js_commonjs-module.js +0 -3
- package/_vendor/seedrandom/lib/xor4096.js_commonjs-proxy.js +0 -1
- package/_vendor/seedrandom/lib/xorshift7.js_commonjs-module.js +0 -3
- package/_vendor/seedrandom/lib/xorshift7.js_commonjs-proxy.js +0 -1
- package/_vendor/seedrandom/lib/xorwow.js_commonjs-module.js +0 -3
- package/_vendor/seedrandom/lib/xorwow.js_commonjs-proxy.js +0 -1
- package/_vendor/seedrandom/seedrandom.js_commonjs-module.js +0 -3
- package/_vendor/seedrandom/seedrandom.js_commonjs-proxy.js +0 -1
- package/_vendor/webworker-promise/lib/register.js_commonjs-module.js +0 -3
- package/_vendor/webworker-promise/lib/tiny-emitter.js_commonjs-proxy.js +0 -1
- package/_vendor/webworker-promise/src/tiny-emitter.js_commonjs-proxy.js +0 -1
- package/_vendor/xmlbuilder2/lib/xmlbuilder2.min.js_commonjs-module.js +0 -3
- package/_virtual/_rollup_plugin_ignore_empty_module_placeholder_commonjs-proxy.js +0 -6
- package/_virtual/commonjsHelpers.js +0 -22
- package/_virtual/polyfill-node.buffer.js +0 -1971
- package/_virtual/polyfill-node.global.js +0 -5
- package/_virtual/rollup_plugin_ignore_empty_module_placeholder.js +0 -8
- package/vendor/base64-js/index.js +0 -72
- package/vendor/blueimp-md5/js/md5.js +0 -402
- package/vendor/d3-array/src/array.js +0 -1
- package/vendor/d3-array/src/ascending.js +0 -5
- package/vendor/d3-array/src/bin.js +0 -1
- package/vendor/d3-array/src/bisect.js +0 -10
- package/vendor/d3-array/src/bisector.js +0 -46
- package/vendor/d3-array/src/constant.js +0 -1
- package/vendor/d3-array/src/count.js +0 -1
- package/vendor/d3-array/src/cross.js +0 -1
- package/vendor/d3-array/src/cumsum.js +0 -1
- package/vendor/d3-array/src/descending.js +0 -1
- package/vendor/d3-array/src/deviation.js +0 -1
- package/vendor/d3-array/src/difference.js +0 -1
- package/vendor/d3-array/src/disjoint.js +0 -1
- package/vendor/d3-array/src/every.js +0 -1
- package/vendor/d3-array/src/extent.js +0 -1
- package/vendor/d3-array/src/filter.js +0 -1
- package/vendor/d3-array/src/fsum.js +0 -1
- package/vendor/d3-array/src/greatest.js +0 -1
- package/vendor/d3-array/src/greatestIndex.js +0 -1
- package/vendor/d3-array/src/group.js +0 -1
- package/vendor/d3-array/src/groupSort.js +0 -1
- package/vendor/d3-array/src/identity.js +0 -1
- package/vendor/d3-array/src/index.js +0 -1
- package/vendor/d3-array/src/intersection.js +0 -1
- package/vendor/d3-array/src/least.js +0 -1
- package/vendor/d3-array/src/leastIndex.js +0 -1
- package/vendor/d3-array/src/map.js +0 -1
- package/vendor/d3-array/src/max.js +0 -1
- package/vendor/d3-array/src/maxIndex.js +0 -1
- package/vendor/d3-array/src/mean.js +0 -1
- package/vendor/d3-array/src/median.js +0 -1
- package/vendor/d3-array/src/merge.js +0 -1
- package/vendor/d3-array/src/min.js +0 -1
- package/vendor/d3-array/src/minIndex.js +0 -1
- package/vendor/d3-array/src/mode.js +0 -1
- package/vendor/d3-array/src/nice.js +0 -1
- package/vendor/d3-array/src/number.js +0 -5
- package/vendor/d3-array/src/pairs.js +0 -1
- package/vendor/d3-array/src/permute.js +0 -1
- package/vendor/d3-array/src/quantile.js +0 -1
- package/vendor/d3-array/src/quickselect.js +0 -1
- package/vendor/d3-array/src/range.js +0 -1
- package/vendor/d3-array/src/reduce.js +0 -1
- package/vendor/d3-array/src/reverse.js +0 -1
- package/vendor/d3-array/src/scan.js +0 -1
- package/vendor/d3-array/src/set.js +0 -1
- package/vendor/d3-array/src/shuffle.js +0 -1
- package/vendor/d3-array/src/some.js +0 -1
- package/vendor/d3-array/src/sort.js +0 -1
- package/vendor/d3-array/src/subset.js +0 -1
- package/vendor/d3-array/src/sum.js +0 -1
- package/vendor/d3-array/src/superset.js +0 -1
- package/vendor/d3-array/src/threshold/freedmanDiaconis.js +0 -1
- package/vendor/d3-array/src/threshold/scott.js +0 -1
- package/vendor/d3-array/src/threshold/sturges.js +0 -1
- package/vendor/d3-array/src/ticks.js +0 -56
- package/vendor/d3-array/src/transpose.js +0 -1
- package/vendor/d3-array/src/union.js +0 -1
- package/vendor/d3-array/src/variance.js +0 -1
- package/vendor/d3-array/src/zip.js +0 -1
- package/vendor/d3-color/src/color.js +0 -373
- package/vendor/d3-color/src/cubehelix.js +0 -1
- package/vendor/d3-color/src/define.js +0 -12
- package/vendor/d3-color/src/index.js +0 -1
- package/vendor/d3-color/src/lab.js +0 -1
- package/vendor/d3-color/src/math.js +0 -1
- package/vendor/d3-format/src/defaultLocale.js +0 -20
- package/vendor/d3-format/src/exponent.js +0 -7
- package/vendor/d3-format/src/formatDecimal.js +0 -22
- package/vendor/d3-format/src/formatGroup.js +0 -20
- package/vendor/d3-format/src/formatNumerals.js +0 -9
- package/vendor/d3-format/src/formatPrefixAuto.js +0 -18
- package/vendor/d3-format/src/formatRounded.js +0 -13
- package/vendor/d3-format/src/formatSpecifier.js +0 -49
- package/vendor/d3-format/src/formatTrim.js +0 -13
- package/vendor/d3-format/src/formatTypes.js +0 -21
- package/vendor/d3-format/src/identity.js +0 -5
- package/vendor/d3-format/src/index.js +0 -1
- package/vendor/d3-format/src/locale.js +0 -150
- package/vendor/d3-format/src/precisionFixed.js +0 -7
- package/vendor/d3-format/src/precisionPrefix.js +0 -7
- package/vendor/d3-format/src/precisionRound.js +0 -8
- package/vendor/d3-interpolate/src/array.js +0 -19
- package/vendor/d3-interpolate/src/basis.js +0 -1
- package/vendor/d3-interpolate/src/basisClosed.js +0 -1
- package/vendor/d3-interpolate/src/color.js +0 -26
- package/vendor/d3-interpolate/src/constant.js +0 -3
- package/vendor/d3-interpolate/src/cubehelix.js +0 -1
- package/vendor/d3-interpolate/src/date.js +0 -8
- package/vendor/d3-interpolate/src/discrete.js +0 -1
- package/vendor/d3-interpolate/src/hcl.js +0 -1
- package/vendor/d3-interpolate/src/hsl.js +0 -1
- package/vendor/d3-interpolate/src/hue.js +0 -1
- package/vendor/d3-interpolate/src/index.js +0 -1
- package/vendor/d3-interpolate/src/lab.js +0 -1
- package/vendor/d3-interpolate/src/number.js +0 -7
- package/vendor/d3-interpolate/src/numberArray.js +0 -16
- package/vendor/d3-interpolate/src/object.js +0 -25
- package/vendor/d3-interpolate/src/piecewise.js +0 -1
- package/vendor/d3-interpolate/src/quantize.js +0 -1
- package/vendor/d3-interpolate/src/rgb.js +0 -26
- package/vendor/d3-interpolate/src/round.js +0 -7
- package/vendor/d3-interpolate/src/string.js +0 -66
- package/vendor/d3-interpolate/src/transform/decompose.js +0 -1
- package/vendor/d3-interpolate/src/transform/index.js +0 -1
- package/vendor/d3-interpolate/src/transform/parse.js +0 -1
- package/vendor/d3-interpolate/src/value.js +0 -24
- package/vendor/d3-interpolate/src/zoom.js +0 -1
- package/vendor/d3-scale/src/band.js +0 -1
- package/vendor/d3-scale/src/constant.js +0 -7
- package/vendor/d3-scale/src/continuous.js +0 -129
- package/vendor/d3-scale/src/diverging.js +0 -1
- package/vendor/d3-scale/src/identity.js +0 -1
- package/vendor/d3-scale/src/index.js +0 -1
- package/vendor/d3-scale/src/init.js +0 -10
- package/vendor/d3-scale/src/linear.js +0 -72
- package/vendor/d3-scale/src/log.js +0 -1
- package/vendor/d3-scale/src/nice.js +0 -1
- package/vendor/d3-scale/src/number.js +0 -5
- package/vendor/d3-scale/src/ordinal.js +0 -1
- package/vendor/d3-scale/src/pow.js +0 -1
- package/vendor/d3-scale/src/quantile.js +0 -1
- package/vendor/d3-scale/src/quantize.js +0 -1
- package/vendor/d3-scale/src/radial.js +0 -1
- package/vendor/d3-scale/src/sequential.js +0 -1
- package/vendor/d3-scale/src/sequentialQuantile.js +0 -1
- package/vendor/d3-scale/src/symlog.js +0 -1
- package/vendor/d3-scale/src/threshold.js +0 -1
- package/vendor/d3-scale/src/tickFormat.js +0 -35
- package/vendor/d3-scale/src/time.js +0 -1
- package/vendor/d3-scale/src/utcTime.js +0 -1
- package/vendor/d3-time/src/day.js +0 -1
- package/vendor/d3-time/src/duration.js +0 -1
- package/vendor/d3-time/src/hour.js +0 -1
- package/vendor/d3-time/src/index.js +0 -1
- package/vendor/d3-time/src/interval.js +0 -1
- package/vendor/d3-time/src/millisecond.js +0 -1
- package/vendor/d3-time/src/minute.js +0 -1
- package/vendor/d3-time/src/month.js +0 -1
- package/vendor/d3-time/src/second.js +0 -1
- package/vendor/d3-time/src/ticks.js +0 -1
- package/vendor/d3-time/src/utcDay.js +0 -1
- package/vendor/d3-time/src/utcHour.js +0 -1
- package/vendor/d3-time/src/utcMinute.js +0 -1
- package/vendor/d3-time/src/utcMonth.js +0 -1
- package/vendor/d3-time/src/utcWeek.js +0 -1
- package/vendor/d3-time/src/utcYear.js +0 -1
- package/vendor/d3-time/src/week.js +0 -1
- package/vendor/d3-time/src/year.js +0 -1
- package/vendor/d3-time-format/src/defaultLocale.js +0 -1
- package/vendor/d3-time-format/src/index.js +0 -1
- package/vendor/d3-time-format/src/isoFormat.js +0 -1
- package/vendor/d3-time-format/src/isoParse.js +0 -1
- package/vendor/d3-time-format/src/locale.js +0 -1
- package/vendor/define-properties/index.js +0 -60
- package/vendor/gl-matrix/esm/common.js +0 -30
- package/vendor/gl-matrix/esm/index.js +0 -1
- package/vendor/gl-matrix/esm/mat2.js +0 -1
- package/vendor/gl-matrix/esm/mat2d.js +0 -1
- package/vendor/gl-matrix/esm/mat3.js +0 -817
- package/vendor/gl-matrix/esm/mat4.js +0 -1868
- package/vendor/gl-matrix/esm/quat.js +0 -330
- package/vendor/gl-matrix/esm/quat2.js +0 -1
- package/vendor/gl-matrix/esm/vec2.js +0 -1
- package/vendor/gl-matrix/esm/vec3.js +0 -842
- package/vendor/gl-matrix/esm/vec4.js +0 -153
- package/vendor/globalthis/implementation.browser.js +0 -11
- package/vendor/globalthis/index.js +0 -25
- package/vendor/globalthis/polyfill.js +0 -14
- package/vendor/globalthis/shim.js +0 -25
- package/vendor/internmap/src/index.js +0 -1
- package/vendor/jszip/dist/jszip.min.js +0 -11
- package/vendor/object-keys/implementation.js +0 -124
- package/vendor/object-keys/index.js +0 -35
- package/vendor/object-keys/isArguments.js +0 -17
- package/vendor/pako/dist/pako.esm.mjs.js +0 -6707
- package/vendor/seedrandom/index.js +0 -77
- package/vendor/seedrandom/lib/alea.js +0 -117
- package/vendor/seedrandom/lib/tychei.js +0 -105
- package/vendor/seedrandom/lib/xor128.js +0 -84
- package/vendor/seedrandom/lib/xor4096.js +0 -150
- package/vendor/seedrandom/lib/xorshift7.js +0 -101
- package/vendor/seedrandom/lib/xorwow.js +0 -89
- package/vendor/seedrandom/seedrandom.js +0 -256
- package/vendor/webworker-promise/lib/register.js +0 -158
- package/vendor/webworker-promise/lib/tiny-emitter.js +0 -89
- package/vendor/webworker-promise/src/index.js +0 -110
- package/vendor/webworker-promise/src/tiny-emitter.js +0 -51
- 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
|
-
|