@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.
- package/Common/Core/Base64.d.ts +14 -2
- package/Common/Core/Base64.js +31 -2
- package/Common/Core/Math/index.js +3 -3
- package/Common/Core/Math.d.ts +128 -128
- package/Common/Core/Math.js +1 -1
- package/Common/Core/MatrixBuilder.js +39 -41
- 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/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/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/Camera.js +81 -84
- package/Rendering/Core/CellPicker.js +2 -2
- package/Rendering/Core/CubeAxesActor.js +32 -33
- 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.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 +32 -33
- 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 +37 -1
- 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/Texture.js +10 -9
- 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/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,13 +1,11 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
3
|
+
import { mat4, vec3, mat3 } from 'gl-matrix';
|
|
3
4
|
import Constants from './Glyph3DMapper/Constants.js';
|
|
4
5
|
import macro from '../../macros.js';
|
|
5
6
|
import vtkMapper from './Mapper.js';
|
|
6
7
|
import { M as createUninitializedBounds, n as norm } from '../../Common/Core/Math/index.js';
|
|
7
8
|
import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
|
|
8
|
-
import { i as identity, t as translate, b as rotateY, r as rotate, c as rotateZ, a as rotateX, m as multiply, s as scale } from '../../vendor/gl-matrix/esm/mat4.js';
|
|
9
|
-
import { t as transformMat4 } from '../../vendor/gl-matrix/esm/vec3.js';
|
|
10
|
-
import { f as fromMat4, a as invert, t as transpose } from '../../vendor/gl-matrix/esm/mat3.js';
|
|
11
9
|
|
|
12
10
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
13
11
|
|
|
@@ -141,9 +139,9 @@ function vtkGlyph3DMapper(publicAPI, model) {
|
|
|
141
139
|
model.bounds[5] = vtkBoundingBox.INIT_BOUNDS[5];
|
|
142
140
|
var tcorner = new Float64Array(3);
|
|
143
141
|
var oArray = publicAPI.getOrientationArrayData();
|
|
144
|
-
var identity
|
|
142
|
+
var identity = mat4.identity(new Float64Array(16));
|
|
145
143
|
var trans = [];
|
|
146
|
-
var scale
|
|
144
|
+
var scale = [];
|
|
147
145
|
var numPts = pts.length / 3;
|
|
148
146
|
model.matrixArray = new Float32Array(16 * numPts);
|
|
149
147
|
var mbuff = model.matrixArray.buffer;
|
|
@@ -156,7 +154,7 @@ function vtkGlyph3DMapper(publicAPI, model) {
|
|
|
156
154
|
trans[0] = pts[i * 3];
|
|
157
155
|
trans[1] = pts[i * 3 + 1];
|
|
158
156
|
trans[2] = pts[i * 3 + 2];
|
|
159
|
-
translate(z, identity
|
|
157
|
+
mat4.translate(z, identity, trans);
|
|
160
158
|
|
|
161
159
|
if (oArray) {
|
|
162
160
|
var orientation = [];
|
|
@@ -167,20 +165,20 @@ function vtkGlyph3DMapper(publicAPI, model) {
|
|
|
167
165
|
{
|
|
168
166
|
// prettier-ignore
|
|
169
167
|
var rotMat4 = [].concat(_toConsumableArray(orientation.slice(0, 3)), [0], _toConsumableArray(orientation.slice(3, 6)), [0], _toConsumableArray(orientation.slice(6, 9)), [0, 0, 0, 0, 1]);
|
|
170
|
-
multiply(z, z, rotMat4);
|
|
168
|
+
mat4.multiply(z, z, rotMat4);
|
|
171
169
|
break;
|
|
172
170
|
}
|
|
173
171
|
|
|
174
172
|
case OrientationModes.ROTATION:
|
|
175
|
-
rotateZ(z, z, orientation[2]);
|
|
176
|
-
rotateX(z, z, orientation[0]);
|
|
177
|
-
rotateY(z, z, orientation[1]);
|
|
173
|
+
mat4.rotateZ(z, z, orientation[2]);
|
|
174
|
+
mat4.rotateX(z, z, orientation[0]);
|
|
175
|
+
mat4.rotateY(z, z, orientation[1]);
|
|
178
176
|
break;
|
|
179
177
|
|
|
180
178
|
case OrientationModes.DIRECTION:
|
|
181
179
|
if (orientation[1] === 0.0 && orientation[2] === 0.0) {
|
|
182
180
|
if (orientation[0] < 0) {
|
|
183
|
-
rotateY(z, z, 3.1415926);
|
|
181
|
+
mat4.rotateY(z, z, 3.1415926);
|
|
184
182
|
}
|
|
185
183
|
} else {
|
|
186
184
|
var vMag = norm(orientation);
|
|
@@ -188,7 +186,7 @@ function vtkGlyph3DMapper(publicAPI, model) {
|
|
|
188
186
|
vNew[0] = (orientation[0] + vMag) / 2.0;
|
|
189
187
|
vNew[1] = orientation[1] / 2.0;
|
|
190
188
|
vNew[2] = orientation[2] / 2.0;
|
|
191
|
-
rotate(z, z, 3.1415926, vNew);
|
|
189
|
+
mat4.rotate(z, z, 3.1415926, vNew);
|
|
192
190
|
}
|
|
193
191
|
|
|
194
192
|
break;
|
|
@@ -197,9 +195,9 @@ function vtkGlyph3DMapper(publicAPI, model) {
|
|
|
197
195
|
|
|
198
196
|
|
|
199
197
|
if (model.scaling) {
|
|
200
|
-
scale
|
|
201
|
-
scale
|
|
202
|
-
scale
|
|
198
|
+
scale[0] = model.scaleFactor;
|
|
199
|
+
scale[1] = model.scaleFactor;
|
|
200
|
+
scale[2] = model.scaleFactor; // Get the scalar and vector data
|
|
203
201
|
|
|
204
202
|
if (sArray) {
|
|
205
203
|
switch (model.scaleMode) {
|
|
@@ -208,9 +206,9 @@ function vtkGlyph3DMapper(publicAPI, model) {
|
|
|
208
206
|
tuple[t] = sData[i * numSComp + t];
|
|
209
207
|
}
|
|
210
208
|
|
|
211
|
-
scale
|
|
212
|
-
scale
|
|
213
|
-
scale
|
|
209
|
+
scale[0] *= norm(tuple, numSComp);
|
|
210
|
+
scale[1] = scale[0];
|
|
211
|
+
scale[2] = scale[0];
|
|
214
212
|
break;
|
|
215
213
|
|
|
216
214
|
case ScaleModes.SCALE_BY_COMPONENTS:
|
|
@@ -218,33 +216,33 @@ function vtkGlyph3DMapper(publicAPI, model) {
|
|
|
218
216
|
tuple[_t] = sData[i * numSComp + _t];
|
|
219
217
|
}
|
|
220
218
|
|
|
221
|
-
scale
|
|
222
|
-
scale
|
|
223
|
-
scale
|
|
219
|
+
scale[0] *= tuple[0];
|
|
220
|
+
scale[1] *= tuple[1];
|
|
221
|
+
scale[2] *= tuple[2];
|
|
224
222
|
break;
|
|
225
223
|
|
|
226
224
|
case ScaleModes.SCALE_BY_CONSTANT:
|
|
227
225
|
}
|
|
228
226
|
}
|
|
229
227
|
|
|
230
|
-
if (scale
|
|
231
|
-
scale
|
|
228
|
+
if (scale[0] === 0.0) {
|
|
229
|
+
scale[0] = 1.0e-10;
|
|
232
230
|
}
|
|
233
231
|
|
|
234
|
-
if (scale
|
|
235
|
-
scale
|
|
232
|
+
if (scale[1] === 0.0) {
|
|
233
|
+
scale[1] = 1.0e-10;
|
|
236
234
|
}
|
|
237
235
|
|
|
238
|
-
if (scale
|
|
239
|
-
scale
|
|
236
|
+
if (scale[2] === 0.0) {
|
|
237
|
+
scale[2] = 1.0e-10;
|
|
240
238
|
}
|
|
241
239
|
|
|
242
|
-
scale(z, z, scale
|
|
240
|
+
mat4.scale(z, z, scale);
|
|
243
241
|
} // update bounds
|
|
244
242
|
|
|
245
243
|
|
|
246
244
|
for (var p = 0; p < 8; ++p) {
|
|
247
|
-
transformMat4(tcorner, corners[p], z);
|
|
245
|
+
vec3.transformMat4(tcorner, corners[p], z);
|
|
248
246
|
|
|
249
247
|
if (tcorner[0] < model.bounds[0]) {
|
|
250
248
|
model.bounds[0] = tcorner[0];
|
|
@@ -272,9 +270,9 @@ function vtkGlyph3DMapper(publicAPI, model) {
|
|
|
272
270
|
}
|
|
273
271
|
|
|
274
272
|
var n = new Float32Array(nbuff, i * 36, 9);
|
|
275
|
-
fromMat4(n, z);
|
|
276
|
-
invert(n, n);
|
|
277
|
-
transpose(n, n);
|
|
273
|
+
mat3.fromMat4(n, z);
|
|
274
|
+
mat3.invert(n, n);
|
|
275
|
+
mat3.transpose(n, n);
|
|
278
276
|
} // map scalars as well
|
|
279
277
|
|
|
280
278
|
|
|
@@ -5,7 +5,7 @@ import vtkAbstractMapper from './AbstractMapper.js';
|
|
|
5
5
|
import { A as clampValue, N as multiply3x3_vect3, M as createUninitializedBounds } from '../../Common/Core/Math/index.js';
|
|
6
6
|
import vtkPlane from '../../Common/DataModel/Plane.js';
|
|
7
7
|
import CoincidentTopologyHelper from './Mapper/CoincidentTopologyHelper.js';
|
|
8
|
-
import {
|
|
8
|
+
import { vec3 } from 'gl-matrix';
|
|
9
9
|
|
|
10
10
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
11
11
|
|
|
@@ -368,7 +368,7 @@ function vtkImageMapper(publicAPI, model) {
|
|
|
368
368
|
worldNormal[0] -= worldOrigin[0];
|
|
369
369
|
worldNormal[1] -= worldOrigin[1];
|
|
370
370
|
worldNormal[2] -= worldOrigin[2];
|
|
371
|
-
normalize(worldNormal, worldNormal);
|
|
371
|
+
vec3.normalize(worldNormal, worldNormal);
|
|
372
372
|
var intersect = vtkPlane.intersectWithLine(p1, p2, worldOrigin, worldNormal);
|
|
373
373
|
|
|
374
374
|
if (intersect.intersection) {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import { mat4, vec3 } from 'gl-matrix';
|
|
1
2
|
import macro from '../../macros.js';
|
|
2
3
|
import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
|
|
3
4
|
import vtkProp3D from './Prop3D.js';
|
|
4
5
|
import vtkImageProperty from './ImageProperty.js';
|
|
5
|
-
import { j as transpose } from '../../vendor/gl-matrix/esm/mat4.js';
|
|
6
|
-
import { t as transformMat4 } from '../../vendor/gl-matrix/esm/vec3.js';
|
|
7
6
|
|
|
8
7
|
var vtkDebugMacro = macro.vtkDebugMacro; // ----------------------------------------------------------------------------
|
|
9
8
|
// vtkImageSlice methods
|
|
@@ -106,9 +105,9 @@ function vtkImageSlice(publicAPI, model) {
|
|
|
106
105
|
vtkBoundingBox.getCorners(bds, bbox);
|
|
107
106
|
publicAPI.computeMatrix();
|
|
108
107
|
var tmp4 = new Float64Array(16);
|
|
109
|
-
transpose(tmp4, model.matrix);
|
|
108
|
+
mat4.transpose(tmp4, model.matrix);
|
|
110
109
|
bbox.forEach(function (pt) {
|
|
111
|
-
return transformMat4(pt, pt, tmp4);
|
|
110
|
+
return vec3.transformMat4(pt, pt, tmp4);
|
|
112
111
|
});
|
|
113
112
|
/* eslint-disable no-multi-assign */
|
|
114
113
|
|
|
@@ -147,9 +146,9 @@ function vtkImageSlice(publicAPI, model) {
|
|
|
147
146
|
vtkBoundingBox.getCorners(bds, bbox);
|
|
148
147
|
publicAPI.computeMatrix();
|
|
149
148
|
var tmp4 = new Float64Array(16);
|
|
150
|
-
transpose(tmp4, model.matrix);
|
|
149
|
+
mat4.transpose(tmp4, model.matrix);
|
|
151
150
|
bbox.forEach(function (pt) {
|
|
152
|
-
return transformMat4(pt, pt, tmp4);
|
|
151
|
+
return vec3.transformMat4(pt, pt, tmp4);
|
|
153
152
|
});
|
|
154
153
|
var newBounds = [Number.MAX_VALUE, -Number.MAX_VALUE, Number.MAX_VALUE, -Number.MAX_VALUE, Number.MAX_VALUE, -Number.MAX_VALUE];
|
|
155
154
|
newBounds = newBounds.map(function (d, i) {
|
package/Rendering/Core/Picker.js
CHANGED
|
@@ -3,8 +3,7 @@ import macro from '../../macros.js';
|
|
|
3
3
|
import vtkAbstractPicker from './AbstractPicker.js';
|
|
4
4
|
import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
|
|
5
5
|
import { d as dot, l as normalize, n as norm, f as distance2BetweenPoints } from '../../Common/Core/Math/index.js';
|
|
6
|
-
import {
|
|
7
|
-
import { t as transformMat4 } from '../../vendor/gl-matrix/esm/vec4.js';
|
|
6
|
+
import { mat4, vec4 } from 'gl-matrix';
|
|
8
7
|
|
|
9
8
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
10
9
|
|
|
@@ -207,8 +206,8 @@ function vtkPicker(publicAPI, model) {
|
|
|
207
206
|
model.transformMatrix = prop.getMatrix().slice(0); // Webgl need a transpose matrix but we need the untransposed one to project world points
|
|
208
207
|
// into the right referential
|
|
209
208
|
|
|
210
|
-
transpose(model.transformMatrix, model.transformMatrix);
|
|
211
|
-
invert(model.transformMatrix, model.transformMatrix); // Extract scale
|
|
209
|
+
mat4.transpose(model.transformMatrix, model.transformMatrix);
|
|
210
|
+
mat4.invert(model.transformMatrix, model.transformMatrix); // Extract scale
|
|
212
211
|
|
|
213
212
|
var col1 = [model.transformMatrix[0], model.transformMatrix[1], model.transformMatrix[2]];
|
|
214
213
|
var col2 = [model.transformMatrix[4], model.transformMatrix[5], model.transformMatrix[6]];
|
|
@@ -216,8 +215,8 @@ function vtkPicker(publicAPI, model) {
|
|
|
216
215
|
scale[0] = norm(col1);
|
|
217
216
|
scale[1] = norm(col2);
|
|
218
217
|
scale[2] = norm(col3);
|
|
219
|
-
transformMat4(p1Mapper, p1World, model.transformMatrix);
|
|
220
|
-
transformMat4(p2Mapper, p2World, model.transformMatrix);
|
|
218
|
+
vec4.transformMat4(p1Mapper, p1World, model.transformMatrix);
|
|
219
|
+
vec4.transformMat4(p2Mapper, p2World, model.transformMatrix);
|
|
221
220
|
p1Mapper[0] /= p1Mapper[3];
|
|
222
221
|
p1Mapper[1] /= p1Mapper[3];
|
|
223
222
|
p1Mapper[2] /= p1Mapper[3];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import { mat4, vec3 } from 'gl-matrix';
|
|
1
2
|
import macro from '../../macros.js';
|
|
2
3
|
import vtkMapper from './Mapper.js';
|
|
3
|
-
import { j as transpose } from '../../vendor/gl-matrix/esm/mat4.js';
|
|
4
|
-
import { t as transformMat4 } from '../../vendor/gl-matrix/esm/vec3.js';
|
|
5
4
|
|
|
6
5
|
// vtkPixelSpaceCallbackMapper methods
|
|
7
6
|
// ----------------------------------------------------------------------------
|
|
@@ -19,7 +18,7 @@ function vtkPixelSpaceCallbackMapper(publicAPI, model) {
|
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
var matrix = camera.getCompositeProjectionMatrix(aspect, -1, 1);
|
|
22
|
-
transpose(matrix, matrix);
|
|
21
|
+
mat4.transpose(matrix, matrix);
|
|
23
22
|
var dataPoints = dataset.getPoints();
|
|
24
23
|
var result = new Float64Array(3);
|
|
25
24
|
var width = windowSize.usize;
|
|
@@ -30,7 +29,7 @@ function vtkPixelSpaceCallbackMapper(publicAPI, model) {
|
|
|
30
29
|
|
|
31
30
|
for (var pidx = 0; pidx < dataPoints.getNumberOfPoints(); pidx += 1) {
|
|
32
31
|
var point = dataPoints.getPoint(pidx);
|
|
33
|
-
transformMat4(result, point, matrix);
|
|
32
|
+
vec3.transformMat4(result, point, matrix);
|
|
34
33
|
var coord = [result[0] * hw + hw, result[1] * hh + hh, result[2], 0];
|
|
35
34
|
|
|
36
35
|
if (depthValues) {
|
package/Rendering/Core/Prop3D.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import { mat4, quat } from 'gl-matrix';
|
|
1
2
|
import macro from '../../macros.js';
|
|
2
3
|
import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
|
|
3
4
|
import { y as degreesFromRadians, r as radiansFromDegrees } from '../../Common/Core/Math/index.js';
|
|
4
5
|
import vtkProp from './Prop.js';
|
|
5
|
-
import { i as identity, n as getRotation, a as rotateX, b as rotateY, c as rotateZ, k as fromQuat, m as multiply, d as copy, t as translate, s as scale, j as transpose } from '../../vendor/gl-matrix/esm/mat4.js';
|
|
6
|
-
import { c as create, g as getAxisAngle, s as setAxisAngle } from '../../vendor/gl-matrix/esm/quat.js';
|
|
7
6
|
|
|
8
7
|
// vtkProp3D methods
|
|
9
8
|
// ----------------------------------------------------------------------------
|
|
@@ -20,10 +19,10 @@ function vtkProp3D(publicAPI, model) {
|
|
|
20
19
|
};
|
|
21
20
|
|
|
22
21
|
publicAPI.getOrientationWXYZ = function () {
|
|
23
|
-
var q = create();
|
|
24
|
-
getRotation(q, model.rotation);
|
|
22
|
+
var q = quat.create();
|
|
23
|
+
mat4.getRotation(q, model.rotation);
|
|
25
24
|
var oaxis = new Float64Array(3);
|
|
26
|
-
var w = getAxisAngle(oaxis, q);
|
|
25
|
+
var w = quat.getAxisAngle(oaxis, q);
|
|
27
26
|
return [degreesFromRadians(w), oaxis[0], oaxis[1], oaxis[2]];
|
|
28
27
|
};
|
|
29
28
|
|
|
@@ -32,7 +31,7 @@ function vtkProp3D(publicAPI, model) {
|
|
|
32
31
|
return;
|
|
33
32
|
}
|
|
34
33
|
|
|
35
|
-
rotateX(model.rotation, model.rotation, radiansFromDegrees(val));
|
|
34
|
+
mat4.rotateX(model.rotation, model.rotation, radiansFromDegrees(val));
|
|
36
35
|
publicAPI.modified();
|
|
37
36
|
};
|
|
38
37
|
|
|
@@ -41,7 +40,7 @@ function vtkProp3D(publicAPI, model) {
|
|
|
41
40
|
return;
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
rotateY(model.rotation, model.rotation, radiansFromDegrees(val));
|
|
43
|
+
mat4.rotateY(model.rotation, model.rotation, radiansFromDegrees(val));
|
|
45
44
|
publicAPI.modified();
|
|
46
45
|
};
|
|
47
46
|
|
|
@@ -50,7 +49,7 @@ function vtkProp3D(publicAPI, model) {
|
|
|
50
49
|
return;
|
|
51
50
|
}
|
|
52
51
|
|
|
53
|
-
rotateZ(model.rotation, model.rotation, radiansFromDegrees(val));
|
|
52
|
+
mat4.rotateZ(model.rotation, model.rotation, radiansFromDegrees(val));
|
|
54
53
|
publicAPI.modified();
|
|
55
54
|
};
|
|
56
55
|
|
|
@@ -61,11 +60,11 @@ function vtkProp3D(publicAPI, model) {
|
|
|
61
60
|
|
|
62
61
|
|
|
63
62
|
var angle = radiansFromDegrees(degrees);
|
|
64
|
-
var q = create();
|
|
65
|
-
setAxisAngle(q, [x, y, z], angle);
|
|
63
|
+
var q = quat.create();
|
|
64
|
+
quat.setAxisAngle(q, [x, y, z], angle);
|
|
66
65
|
var quatMat = new Float64Array(16);
|
|
67
|
-
fromQuat(quatMat, q);
|
|
68
|
-
multiply(model.rotation, model.rotation, quatMat);
|
|
66
|
+
mat4.fromQuat(quatMat, q);
|
|
67
|
+
mat4.multiply(model.rotation, model.rotation, quatMat);
|
|
69
68
|
publicAPI.modified();
|
|
70
69
|
};
|
|
71
70
|
|
|
@@ -75,7 +74,7 @@ function vtkProp3D(publicAPI, model) {
|
|
|
75
74
|
}
|
|
76
75
|
|
|
77
76
|
model.orientation = [x, y, z];
|
|
78
|
-
identity(model.rotation);
|
|
77
|
+
mat4.identity(model.rotation);
|
|
79
78
|
publicAPI.rotateZ(z);
|
|
80
79
|
publicAPI.rotateX(x);
|
|
81
80
|
publicAPI.rotateY(y);
|
|
@@ -84,7 +83,7 @@ function vtkProp3D(publicAPI, model) {
|
|
|
84
83
|
};
|
|
85
84
|
|
|
86
85
|
publicAPI.setUserMatrix = function (matrix) {
|
|
87
|
-
copy(model.userMatrix, matrix);
|
|
86
|
+
mat4.copy(model.userMatrix, matrix);
|
|
88
87
|
publicAPI.modified();
|
|
89
88
|
};
|
|
90
89
|
|
|
@@ -96,18 +95,18 @@ function vtkProp3D(publicAPI, model) {
|
|
|
96
95
|
publicAPI.computeMatrix = function () {
|
|
97
96
|
// check whether or not need to rebuild the matrix
|
|
98
97
|
if (publicAPI.getMTime() > model.matrixMTime.getMTime()) {
|
|
99
|
-
identity(model.matrix);
|
|
98
|
+
mat4.identity(model.matrix);
|
|
100
99
|
|
|
101
100
|
if (model.userMatrix) {
|
|
102
|
-
multiply(model.matrix, model.matrix, model.userMatrix);
|
|
101
|
+
mat4.multiply(model.matrix, model.matrix, model.userMatrix);
|
|
103
102
|
}
|
|
104
103
|
|
|
105
|
-
translate(model.matrix, model.matrix, model.origin);
|
|
106
|
-
translate(model.matrix, model.matrix, model.position);
|
|
107
|
-
multiply(model.matrix, model.matrix, model.rotation);
|
|
108
|
-
scale(model.matrix, model.matrix, model.scale);
|
|
109
|
-
translate(model.matrix, model.matrix, [-model.origin[0], -model.origin[1], -model.origin[2]]);
|
|
110
|
-
transpose(model.matrix, model.matrix); // check for identity
|
|
104
|
+
mat4.translate(model.matrix, model.matrix, model.origin);
|
|
105
|
+
mat4.translate(model.matrix, model.matrix, model.position);
|
|
106
|
+
mat4.multiply(model.matrix, model.matrix, model.rotation);
|
|
107
|
+
mat4.scale(model.matrix, model.matrix, model.scale);
|
|
108
|
+
mat4.translate(model.matrix, model.matrix, [-model.origin[0], -model.origin[1], -model.origin[2]]);
|
|
109
|
+
mat4.transpose(model.matrix, model.matrix); // check for identity
|
|
111
110
|
|
|
112
111
|
model.isIdentity = true;
|
|
113
112
|
|
|
@@ -183,9 +182,9 @@ function extend(publicAPI, model) {
|
|
|
183
182
|
macro.getArray(publicAPI, model, ['orientation']);
|
|
184
183
|
macro.setGetArray(publicAPI, model, ['origin', 'position', 'scale'], 3); // Object internal instance
|
|
185
184
|
|
|
186
|
-
model.matrix = identity(new Float64Array(16));
|
|
187
|
-
model.rotation = identity(new Float64Array(16));
|
|
188
|
-
model.userMatrix = identity(new Float64Array(16));
|
|
185
|
+
model.matrix = mat4.identity(new Float64Array(16));
|
|
186
|
+
model.rotation = mat4.identity(new Float64Array(16));
|
|
187
|
+
model.userMatrix = mat4.identity(new Float64Array(16));
|
|
189
188
|
model.transform = null; // FIXME
|
|
190
189
|
// Object methods
|
|
191
190
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
import { mat4, vec3 } from 'gl-matrix';
|
|
1
2
|
import { newInstance as newInstance$1, get, setGet, getArray, setGetArray, vtkDebugMacro as vtkDebugMacro$1, vtkErrorMacro as vtkErrorMacro$1, vtkWarningMacro as vtkWarningMacro$1 } from '../../macros.js';
|
|
2
3
|
import vtkCamera from './Camera.js';
|
|
3
4
|
import vtkLight from './Light.js';
|
|
4
5
|
import { O as areBoundsInitialized, u as uninitializeBounds, r as radiansFromDegrees, d as dot, M as createUninitializedBounds } from '../../Common/Core/Math/index.js';
|
|
5
6
|
import vtkViewport from './Viewport.js';
|
|
6
7
|
import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
|
|
7
|
-
import { g as invert, j as transpose } from '../../vendor/gl-matrix/esm/mat4.js';
|
|
8
|
-
import { t as transformMat4 } from '../../vendor/gl-matrix/esm/vec3.js';
|
|
9
8
|
|
|
10
9
|
var vtkDebugMacro = vtkDebugMacro$1,
|
|
11
10
|
vtkErrorMacro = vtkErrorMacro$1,
|
|
@@ -266,11 +265,11 @@ function vtkRenderer(publicAPI, model) {
|
|
|
266
265
|
|
|
267
266
|
|
|
268
267
|
var matrix = model.activeCamera.getViewMatrix();
|
|
269
|
-
invert(matrix, matrix);
|
|
270
|
-
transpose(matrix, matrix); // Transform point to world coordinates
|
|
268
|
+
mat4.invert(matrix, matrix);
|
|
269
|
+
mat4.transpose(matrix, matrix); // Transform point to world coordinates
|
|
271
270
|
|
|
272
271
|
var result = new Float64Array([x, y, z]);
|
|
273
|
-
transformMat4(result, result, matrix);
|
|
272
|
+
vec3.transformMat4(result, result, matrix);
|
|
274
273
|
return result;
|
|
275
274
|
};
|
|
276
275
|
|
|
@@ -282,11 +281,11 @@ function vtkRenderer(publicAPI, model) {
|
|
|
282
281
|
|
|
283
282
|
|
|
284
283
|
var matrix = model.activeCamera.getProjectionMatrix(aspect, -1.0, 1.0);
|
|
285
|
-
invert(matrix, matrix);
|
|
286
|
-
transpose(matrix, matrix); // Transform point to world coordinates
|
|
284
|
+
mat4.invert(matrix, matrix);
|
|
285
|
+
mat4.transpose(matrix, matrix); // Transform point to world coordinates
|
|
287
286
|
|
|
288
287
|
var result = new Float64Array([x, y, z]);
|
|
289
|
-
transformMat4(result, result, matrix);
|
|
288
|
+
vec3.transformMat4(result, result, matrix);
|
|
290
289
|
return result;
|
|
291
290
|
}; // Convert world point coordinates to view coordinates.
|
|
292
291
|
|
|
@@ -299,9 +298,9 @@ function vtkRenderer(publicAPI, model) {
|
|
|
299
298
|
|
|
300
299
|
|
|
301
300
|
var matrix = model.activeCamera.getViewMatrix();
|
|
302
|
-
transpose(matrix, matrix);
|
|
301
|
+
mat4.transpose(matrix, matrix);
|
|
303
302
|
var result = new Float64Array([x, y, z]);
|
|
304
|
-
transformMat4(result, result, matrix);
|
|
303
|
+
vec3.transformMat4(result, result, matrix);
|
|
305
304
|
return result;
|
|
306
305
|
}; // Convert world point coordinates to view coordinates.
|
|
307
306
|
// requires the aspect ratio of the viewport as X/Y
|
|
@@ -315,9 +314,9 @@ function vtkRenderer(publicAPI, model) {
|
|
|
315
314
|
|
|
316
315
|
|
|
317
316
|
var matrix = model.activeCamera.getProjectionMatrix(aspect, -1.0, 1.0);
|
|
318
|
-
transpose(matrix, matrix);
|
|
317
|
+
mat4.transpose(matrix, matrix);
|
|
319
318
|
var result = new Float64Array([x, y, z]);
|
|
320
|
-
transformMat4(result, result, matrix);
|
|
319
|
+
vec3.transformMat4(result, result, matrix);
|
|
321
320
|
return result;
|
|
322
321
|
};
|
|
323
322
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
3
|
+
import { vec3, mat4 } from 'gl-matrix';
|
|
4
|
+
import * as d3 from 'd3-scale';
|
|
3
5
|
import { K as nearestPowerOfTwo } from '../../Common/Core/Math/index.js';
|
|
4
6
|
import macro from '../../macros.js';
|
|
5
7
|
import vtkActor from './Actor.js';
|
|
@@ -9,9 +11,6 @@ import vtkMapper from './Mapper.js';
|
|
|
9
11
|
import vtkPixelSpaceCallbackMapper from './PixelSpaceCallbackMapper.js';
|
|
10
12
|
import vtkPolyData from '../../Common/DataModel/PolyData.js';
|
|
11
13
|
import vtkTexture from './Texture.js';
|
|
12
|
-
import { l as linear } from '../../vendor/d3-scale/src/linear.js';
|
|
13
|
-
import { b as scale, j as add, a as subtract, t as transformMat4 } from '../../vendor/gl-matrix/esm/vec3.js';
|
|
14
|
-
import { j as transpose, g as invert } from '../../vendor/gl-matrix/esm/mat4.js';
|
|
15
14
|
|
|
16
15
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
17
16
|
|
|
@@ -130,7 +129,7 @@ function vtkScalarBarActor(publicAPI, model) {
|
|
|
130
129
|
model.lastTickBounds = _toConsumableArray(range);
|
|
131
130
|
model.barMapper.setScalarRange(model.lastTickBounds); // compute tick marks for axes (update for log scale)
|
|
132
131
|
|
|
133
|
-
var scale =
|
|
132
|
+
var scale = d3.scaleLinear().domain([model.lastTickBounds[0], model.lastTickBounds[1]]);
|
|
134
133
|
model.ticks = scale.ticks(5);
|
|
135
134
|
var format = scale.tickFormat(5);
|
|
136
135
|
model.tickStrings = model.ticks.map(format);
|
|
@@ -378,40 +377,40 @@ function vtkScalarBarActor(publicAPI, model) {
|
|
|
378
377
|
ptv3[2] = pos[2]; // horizontal left, right, or middle alignment based on dir[0]
|
|
379
378
|
|
|
380
379
|
if (dir[0] < -0.5) {
|
|
381
|
-
scale(tmpv3, xdir, dir[0] * offset - value.width);
|
|
380
|
+
vec3.scale(tmpv3, xdir, dir[0] * offset - value.width);
|
|
382
381
|
} else if (dir[0] > 0.5) {
|
|
383
|
-
scale(tmpv3, xdir, dir[0] * offset);
|
|
382
|
+
vec3.scale(tmpv3, xdir, dir[0] * offset);
|
|
384
383
|
} else {
|
|
385
|
-
scale(tmpv3, xdir, dir[0] * offset - value.width / 2.0);
|
|
384
|
+
vec3.scale(tmpv3, xdir, dir[0] * offset - value.width / 2.0);
|
|
386
385
|
}
|
|
387
386
|
|
|
388
|
-
add(ptv3, ptv3, tmpv3);
|
|
389
|
-
scale(tmpv3, ydir, dir[1] * offset - value.height / 2.0);
|
|
390
|
-
add(ptv3, ptv3, tmpv3);
|
|
387
|
+
vec3.add(ptv3, ptv3, tmpv3);
|
|
388
|
+
vec3.scale(tmpv3, ydir, dir[1] * offset - value.height / 2.0);
|
|
389
|
+
vec3.add(ptv3, ptv3, tmpv3);
|
|
391
390
|
results.points[ptIdx * 3] = ptv3[0];
|
|
392
391
|
results.points[ptIdx * 3 + 1] = ptv3[1];
|
|
393
392
|
results.points[ptIdx * 3 + 2] = ptv3[2];
|
|
394
393
|
results.tcoords[ptIdx * 2] = value.tcoords[0];
|
|
395
394
|
results.tcoords[ptIdx * 2 + 1] = value.tcoords[1];
|
|
396
395
|
ptIdx++;
|
|
397
|
-
scale(tmpv3, xdir, value.width);
|
|
398
|
-
add(ptv3, ptv3, tmpv3);
|
|
396
|
+
vec3.scale(tmpv3, xdir, value.width);
|
|
397
|
+
vec3.add(ptv3, ptv3, tmpv3);
|
|
399
398
|
results.points[ptIdx * 3] = ptv3[0];
|
|
400
399
|
results.points[ptIdx * 3 + 1] = ptv3[1];
|
|
401
400
|
results.points[ptIdx * 3 + 2] = ptv3[2];
|
|
402
401
|
results.tcoords[ptIdx * 2] = value.tcoords[2];
|
|
403
402
|
results.tcoords[ptIdx * 2 + 1] = value.tcoords[3];
|
|
404
403
|
ptIdx++;
|
|
405
|
-
scale(tmpv3, ydir, value.height);
|
|
406
|
-
add(ptv3, ptv3, tmpv3);
|
|
404
|
+
vec3.scale(tmpv3, ydir, value.height);
|
|
405
|
+
vec3.add(ptv3, ptv3, tmpv3);
|
|
407
406
|
results.points[ptIdx * 3] = ptv3[0];
|
|
408
407
|
results.points[ptIdx * 3 + 1] = ptv3[1];
|
|
409
408
|
results.points[ptIdx * 3 + 2] = ptv3[2];
|
|
410
409
|
results.tcoords[ptIdx * 2] = value.tcoords[4];
|
|
411
410
|
results.tcoords[ptIdx * 2 + 1] = value.tcoords[5];
|
|
412
411
|
ptIdx++;
|
|
413
|
-
scale(tmpv3, xdir, value.width);
|
|
414
|
-
subtract(ptv3, ptv3, tmpv3);
|
|
412
|
+
vec3.scale(tmpv3, xdir, value.width);
|
|
413
|
+
vec3.subtract(ptv3, ptv3, tmpv3);
|
|
415
414
|
results.points[ptIdx * 3] = ptv3[0];
|
|
416
415
|
results.points[ptIdx * 3 + 1] = ptv3[1];
|
|
417
416
|
results.points[ptIdx * 3 + 2] = ptv3[2];
|
|
@@ -437,25 +436,25 @@ function vtkScalarBarActor(publicAPI, model) {
|
|
|
437
436
|
|
|
438
437
|
publicAPI.updatePolyDataForLabels = function () {
|
|
439
438
|
var cmat = model.camera.getCompositeProjectionMatrix(model.lastAspectRatio, -1, 1);
|
|
440
|
-
transpose(cmat, cmat);
|
|
441
|
-
invert(invmat, cmat);
|
|
439
|
+
mat4.transpose(cmat, cmat);
|
|
440
|
+
mat4.invert(invmat, cmat);
|
|
442
441
|
var size = model.lastSize; // compute pixel to distance factors
|
|
443
442
|
|
|
444
443
|
tmpv3[0] = 0.0;
|
|
445
444
|
tmpv3[1] = 0.0;
|
|
446
445
|
tmpv3[2] = -0.99; // near plane
|
|
447
446
|
|
|
448
|
-
transformMat4(ptv3, tmpv3, invmat); // moving 0.1 in NDC
|
|
447
|
+
vec3.transformMat4(ptv3, tmpv3, invmat); // moving 0.1 in NDC
|
|
449
448
|
|
|
450
449
|
tmpv3[0] += 0.1;
|
|
451
|
-
transformMat4(pt2v3, tmpv3, invmat); // results in WC move of
|
|
450
|
+
vec3.transformMat4(pt2v3, tmpv3, invmat); // results in WC move of
|
|
452
451
|
|
|
453
|
-
subtract(xDir, pt2v3, ptv3);
|
|
452
|
+
vec3.subtract(xDir, pt2v3, ptv3);
|
|
454
453
|
tmpv3[0] -= 0.1;
|
|
455
454
|
tmpv3[1] += 0.1;
|
|
456
|
-
transformMat4(pt2v3, tmpv3, invmat); // results in WC move of
|
|
455
|
+
vec3.transformMat4(pt2v3, tmpv3, invmat); // results in WC move of
|
|
457
456
|
|
|
458
|
-
subtract(yDir, pt2v3, ptv3);
|
|
457
|
+
vec3.subtract(yDir, pt2v3, ptv3);
|
|
459
458
|
|
|
460
459
|
for (var i = 0; i < 3; i++) {
|
|
461
460
|
xDir[i] /= 0.5 * 0.1 * size[0];
|
|
@@ -486,24 +485,24 @@ function vtkScalarBarActor(publicAPI, model) {
|
|
|
486
485
|
if (model.topTitle) {
|
|
487
486
|
tmpv3[0] = model.boxPosition[0] + 0.5 * model.boxSize[0];
|
|
488
487
|
tmpv3[1] = model.barPosition[1] + model.barSize[1];
|
|
489
|
-
transformMat4(ptv3, tmpv3, invmat); // write the axis label
|
|
488
|
+
vec3.transformMat4(ptv3, tmpv3, invmat); // write the axis label
|
|
490
489
|
|
|
491
490
|
publicAPI.createPolyDataForOneLabel(model.axisLabel, ptv3, xDir, yDir, [0, 1], model.axisTitlePixelOffset, results);
|
|
492
491
|
} else {
|
|
493
492
|
tmpv3[0] = model.barPosition[0] + model.barSize[0];
|
|
494
493
|
tmpv3[1] = model.barPosition[1] + 0.5 * model.barSize[1];
|
|
495
|
-
transformMat4(ptv3, tmpv3, invmat); // write the axis label
|
|
494
|
+
vec3.transformMat4(ptv3, tmpv3, invmat); // write the axis label
|
|
496
495
|
|
|
497
|
-
scale(xDir, xDir, -1);
|
|
496
|
+
vec3.scale(xDir, xDir, -1);
|
|
498
497
|
publicAPI.createPolyDataForOneLabel(model.axisLabel, ptv3, yDir, xDir, [0, -1], model.axisTitlePixelOffset, results);
|
|
499
|
-
scale(xDir, xDir, -1);
|
|
498
|
+
vec3.scale(xDir, xDir, -1);
|
|
500
499
|
}
|
|
501
500
|
|
|
502
501
|
dir = [-1, 0];
|
|
503
502
|
} else {
|
|
504
503
|
tmpv3[0] = model.barPosition[0] + 0.5 * model.barSize[0];
|
|
505
504
|
tmpv3[1] = model.barPosition[1] + model.barSize[1];
|
|
506
|
-
transformMat4(ptv3, tmpv3, invmat);
|
|
505
|
+
vec3.transformMat4(ptv3, tmpv3, invmat);
|
|
507
506
|
publicAPI.createPolyDataForOneLabel(model.axisLabel, ptv3, xDir, yDir, dir, model.axisTitlePixelOffset, results);
|
|
508
507
|
}
|
|
509
508
|
|
|
@@ -522,7 +521,7 @@ function vtkScalarBarActor(publicAPI, model) {
|
|
|
522
521
|
tickSeg = seg;
|
|
523
522
|
} else {
|
|
524
523
|
tmp2v3[spacedAxis] = model.barPosition[spacedAxis] + 0.5 * model.barSize[spacedAxis] * (seg.corners[2][spacedAxis] + seg.corners[0][spacedAxis]);
|
|
525
|
-
transformMat4(ptv3, tmp2v3, invmat);
|
|
524
|
+
vec3.transformMat4(ptv3, tmp2v3, invmat);
|
|
526
525
|
publicAPI.createPolyDataForOneLabel(seg.title, ptv3, xDir, yDir, dir, model.tickLabelPixelOffset, results);
|
|
527
526
|
}
|
|
528
527
|
} // write the tick labels
|
|
@@ -534,7 +533,7 @@ function vtkScalarBarActor(publicAPI, model) {
|
|
|
534
533
|
for (var t = 0; t < model.ticks.length; t++) {
|
|
535
534
|
var tickPos = (model.ticks[t] - model.lastTickBounds[0]) / (model.lastTickBounds[1] - model.lastTickBounds[0]);
|
|
536
535
|
tmp2v3[spacedAxis] = tickSegmentStart + tickSegmentSize * tickPos;
|
|
537
|
-
transformMat4(ptv3, tmp2v3, invmat);
|
|
536
|
+
vec3.transformMat4(ptv3, tmp2v3, invmat);
|
|
538
537
|
publicAPI.createPolyDataForOneLabel(model.tickStrings[t], ptv3, xDir, yDir, dir, model.tickLabelPixelOffset, results);
|
|
539
538
|
}
|
|
540
539
|
|
|
@@ -553,8 +552,8 @@ function vtkScalarBarActor(publicAPI, model) {
|
|
|
553
552
|
|
|
554
553
|
publicAPI.updatePolyDataForBarSegments = function () {
|
|
555
554
|
var cmat = model.camera.getCompositeProjectionMatrix(model.lastAspectRatio, -1, 1);
|
|
556
|
-
transpose(cmat, cmat);
|
|
557
|
-
invert(invmat, cmat);
|
|
555
|
+
mat4.transpose(cmat, cmat);
|
|
556
|
+
mat4.invert(invmat, cmat);
|
|
558
557
|
var haveExtraColors = typeof model.scalarsToColors.getNanColor === 'function' && typeof model.scalarsToColors.getAboveRangeColor === 'function' && typeof model.scalarsToColors.getBelowRangeColor === 'function';
|
|
559
558
|
var numPts = 4 + (haveExtraColors ? 12 : 0);
|
|
560
559
|
var numQuads = numPts; // handle vector component mode
|
|
@@ -580,7 +579,7 @@ function vtkScalarBarActor(publicAPI, model) {
|
|
|
580
579
|
for (var e = 0; e < 4; e++) {
|
|
581
580
|
tmp2v3[0] = model.barPosition[0] + seg.corners[e][0] * model.barSize[0];
|
|
582
581
|
tmp2v3[1] = model.barPosition[1] + seg.corners[e][1] * model.barSize[1];
|
|
583
|
-
transformMat4(ptv3, tmp2v3, invmat);
|
|
582
|
+
vec3.transformMat4(ptv3, tmp2v3, invmat);
|
|
584
583
|
points[ptIdx * 3] = ptv3[0];
|
|
585
584
|
points[ptIdx * 3 + 1] = ptv3[1];
|
|
586
585
|
points[ptIdx * 3 + 2] = ptv3[2];
|
package/Rendering/Core/Volume.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import { mat4, vec3 } from 'gl-matrix';
|
|
1
2
|
import macro from '../../macros.js';
|
|
2
3
|
import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
|
|
3
4
|
import vtkProp3D from './Prop3D.js';
|
|
4
5
|
import vtkVolumeProperty from './VolumeProperty.js';
|
|
5
|
-
import { j as transpose } from '../../vendor/gl-matrix/esm/mat4.js';
|
|
6
|
-
import { t as transformMat4 } from '../../vendor/gl-matrix/esm/vec3.js';
|
|
7
6
|
|
|
8
7
|
var vtkDebugMacro = macro.vtkDebugMacro; // ----------------------------------------------------------------------------
|
|
9
8
|
// vtkVolume methods
|
|
@@ -72,9 +71,9 @@ function vtkVolume(publicAPI, model) {
|
|
|
72
71
|
vtkBoundingBox.getCorners(bds, bbox);
|
|
73
72
|
publicAPI.computeMatrix();
|
|
74
73
|
var tmp4 = new Float64Array(16);
|
|
75
|
-
transpose(tmp4, model.matrix);
|
|
74
|
+
mat4.transpose(tmp4, model.matrix);
|
|
76
75
|
bbox.forEach(function (pt) {
|
|
77
|
-
return transformMat4(pt, pt, tmp4);
|
|
76
|
+
return vec3.transformMat4(pt, pt, tmp4);
|
|
78
77
|
});
|
|
79
78
|
/* eslint-disable no-multi-assign */
|
|
80
79
|
|