@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,5 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
2
|
import macro from '../../../macros.js';
|
|
3
|
+
import { mat4, vec4 } from 'gl-matrix';
|
|
3
4
|
import vtkImageMapper from '../../../Rendering/Core/ImageMapper.js';
|
|
4
5
|
import vtkImageReslice from '../../../Imaging/Core/ImageReslice.js';
|
|
5
6
|
import vtkImageSlice from '../../../Rendering/Core/ImageSlice.js';
|
|
@@ -7,8 +8,6 @@ import { k as add, g as subtract, l as normalize } from '../../../Common/Core/Ma
|
|
|
7
8
|
import vtkPlaneSource from '../../../Filters/Sources/PlaneSource.js';
|
|
8
9
|
import vtkWidgetRepresentation from '../WidgetRepresentation.js';
|
|
9
10
|
import { transformPlane, boundPlane } from '../../../Widgets/Widgets3D/ResliceCursorWidget/helpers.js';
|
|
10
|
-
import { i as identity, j as transpose } from '../../../vendor/gl-matrix/esm/mat4.js';
|
|
11
|
-
import { t as transformMat4 } from '../../../vendor/gl-matrix/esm/vec4.js';
|
|
12
11
|
|
|
13
12
|
var vtkErrorMacro = macro.vtkErrorMacro;
|
|
14
13
|
var VTK_INT_MAX = 2147483647; // ----------------------------------------------------------------------------
|
|
@@ -156,7 +155,7 @@ function vtkResliceCursorRepresentation(publicAPI, model) {
|
|
|
156
155
|
var planeSizeX = normalize(planeAxis1);
|
|
157
156
|
var planeSizeY = normalize(planeAxis2);
|
|
158
157
|
var normal = model.planeSource.getNormal();
|
|
159
|
-
identity(model.newResliceAxes);
|
|
158
|
+
mat4.identity(model.newResliceAxes);
|
|
160
159
|
|
|
161
160
|
for (var i = 0; i < 3; i++) {
|
|
162
161
|
model.newResliceAxes[4 * i + 0] = planeAxis1[i];
|
|
@@ -169,9 +168,9 @@ function vtkResliceCursorRepresentation(publicAPI, model) {
|
|
|
169
168
|
var planeOrigin = [].concat(_toConsumableArray(model.planeSource.getOrigin()), [1.0]);
|
|
170
169
|
var originXYZW = [];
|
|
171
170
|
var newOriginXYZW = [];
|
|
172
|
-
transformMat4(originXYZW, planeOrigin, model.newResliceAxes);
|
|
173
|
-
transpose(model.newResliceAxes, model.newResliceAxes);
|
|
174
|
-
transformMat4(newOriginXYZW, originXYZW, model.newResliceAxes);
|
|
171
|
+
vec4.transformMat4(originXYZW, planeOrigin, model.newResliceAxes);
|
|
172
|
+
mat4.transpose(model.newResliceAxes, model.newResliceAxes);
|
|
173
|
+
vec4.transformMat4(newOriginXYZW, originXYZW, model.newResliceAxes);
|
|
175
174
|
model.newResliceAxes[4 * 3 + 0] = newOriginXYZW[0];
|
|
176
175
|
model.newResliceAxes[4 * 3 + 1] = newOriginXYZW[1];
|
|
177
176
|
model.newResliceAxes[4 * 3 + 2] = newOriginXYZW[2]; // Compute a new set of resliced extents
|
|
@@ -250,7 +249,7 @@ function vtkResliceCursorRepresentation(publicAPI, model) {
|
|
|
250
249
|
publicAPI.computeOrigin = function (matrix) {
|
|
251
250
|
var center = publicAPI.getResliceCursor().getCenter();
|
|
252
251
|
var centerTransformed = [];
|
|
253
|
-
transformMat4(centerTransformed, center, matrix);
|
|
252
|
+
vec4.transformMat4(centerTransformed, center, matrix);
|
|
254
253
|
|
|
255
254
|
for (var i = 0; i < 3; i++) {
|
|
256
255
|
matrix[4 * 3 + i] = matrix[4 * 3 + i] + center[i] - centerTransformed[i];
|
|
@@ -346,8 +345,8 @@ function extend(publicAPI, model) {
|
|
|
346
345
|
vtkWidgetRepresentation.extend(publicAPI, model, initialValues);
|
|
347
346
|
model.reslice = null;
|
|
348
347
|
model.planeSource = vtkPlaneSource.newInstance();
|
|
349
|
-
model.resliceAxes = identity(new Float64Array(16));
|
|
350
|
-
model.newResliceAxes = identity(new Float64Array(16));
|
|
348
|
+
model.resliceAxes = mat4.identity(new Float64Array(16));
|
|
349
|
+
model.newResliceAxes = mat4.identity(new Float64Array(16));
|
|
351
350
|
model.imageActor = vtkImageSlice.newInstance();
|
|
352
351
|
model.imageMapper = vtkImageMapper.newInstance();
|
|
353
352
|
model.imageMapper.setResolveCoincidentTopologyToPolygonOffset();
|
package/Rendering/Core/Actor.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import { mat4, vec3 } from 'gl-matrix';
|
|
2
3
|
import macro from '../../macros.js';
|
|
3
4
|
import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
|
|
4
5
|
import vtkProp3D from './Prop3D.js';
|
|
5
6
|
import vtkProperty from './Property.js';
|
|
6
|
-
import { j as transpose } from '../../vendor/gl-matrix/esm/mat4.js';
|
|
7
|
-
import { t as transformMat4 } from '../../vendor/gl-matrix/esm/vec3.js';
|
|
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
|
|
|
@@ -105,9 +104,9 @@ function vtkActor(publicAPI, model) {
|
|
|
105
104
|
vtkBoundingBox.getCorners(bds, bbox);
|
|
106
105
|
publicAPI.computeMatrix();
|
|
107
106
|
var tmp4 = new Float64Array(16);
|
|
108
|
-
transpose(tmp4, model.matrix);
|
|
107
|
+
mat4.transpose(tmp4, model.matrix);
|
|
109
108
|
bbox.forEach(function (pt) {
|
|
110
|
-
return transformMat4(pt, pt, tmp4);
|
|
109
|
+
return vec3.transformMat4(pt, pt, tmp4);
|
|
111
110
|
});
|
|
112
111
|
/* eslint-disable no-multi-assign */
|
|
113
112
|
|
|
@@ -38,31 +38,31 @@ export interface vtkAnnotatedCubeActor extends vtkActor {
|
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* The -X face property.
|
|
41
|
-
* @param {IFaceProperty} prop -X
|
|
41
|
+
* @param {IFaceProperty} prop The -X face property.
|
|
42
42
|
*/
|
|
43
43
|
setXMinusFaceProperty(prop: IFaceProperty): boolean;
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* The +Y face property.
|
|
47
|
-
* @param {IFaceProperty} prop +Y face property
|
|
47
|
+
* @param {IFaceProperty} prop The +Y face property.
|
|
48
48
|
*/
|
|
49
49
|
setYPlusFaceProperty(prop: IFaceProperty): boolean;
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* The -Y face property.
|
|
53
|
-
* @param {IFaceProperty} prop -Y ace property
|
|
53
|
+
* @param {IFaceProperty} prop The -Y ace property.
|
|
54
54
|
*/
|
|
55
55
|
setYMinusFaceProperty(prop: IFaceProperty): boolean;
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
58
|
* The +Z face property.
|
|
59
|
-
* @param {IFaceProperty} prop +Z face property
|
|
59
|
+
* @param {IFaceProperty} prop The +Z face property.
|
|
60
60
|
*/
|
|
61
61
|
setZPlusFaceProperty(prop: IFaceProperty): boolean;
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
64
|
* The -Z face property.
|
|
65
|
-
* @param {IFaceProperty} prop -Z face property
|
|
65
|
+
* @param {IFaceProperty} prop The -Z face property.
|
|
66
66
|
*/
|
|
67
67
|
setZMinusFaceProperty(prop: IFaceProperty): boolean;
|
|
68
68
|
}
|
|
@@ -103,4 +103,3 @@ export declare const vtkAnnotatedCubeActor: {
|
|
|
103
103
|
extend: typeof extend,
|
|
104
104
|
};
|
|
105
105
|
export default vtkAnnotatedCubeActor;
|
|
106
|
-
|
package/Rendering/Core/Camera.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
|
+
import { mat4, vec4, vec3, quat } from 'gl-matrix';
|
|
2
3
|
import macro from '../../macros.js';
|
|
3
4
|
import { r as radiansFromDegrees, k as add, j as cross } from '../../Common/Core/Math/index.js';
|
|
4
|
-
import { i as identity, r as rotate, t as translate, g as invert, j as transpose, s as scale, m as multiply$1, d as copy, l as lookAt, o as ortho, k as fromQuat } from '../../vendor/gl-matrix/esm/mat4.js';
|
|
5
|
-
import { t as transformMat4 } from '../../vendor/gl-matrix/esm/vec4.js';
|
|
6
|
-
import { t as transformMat4$1, s as set, a as subtract, n as normalize } from '../../vendor/gl-matrix/esm/vec3.js';
|
|
7
|
-
import { f as fromValues, c as create, a as conjugate, m as multiply, s as setAxisAngle } from '../../vendor/gl-matrix/esm/quat.js';
|
|
8
5
|
|
|
9
6
|
var vtkDebugMacro = macro.vtkDebugMacro;
|
|
10
7
|
/* eslint-disable new-cap */
|
|
@@ -29,12 +26,12 @@ function vtkCamera(publicAPI, model) {
|
|
|
29
26
|
var origin = new Float64Array(3);
|
|
30
27
|
var dopbasis = new Float64Array([0.0, 0.0, -1.0]);
|
|
31
28
|
var upbasis = new Float64Array([0.0, 1.0, 0.0]);
|
|
32
|
-
var tmpMatrix = identity(new Float64Array(16));
|
|
29
|
+
var tmpMatrix = mat4.identity(new Float64Array(16));
|
|
33
30
|
var tmpvec1 = new Float64Array(3);
|
|
34
31
|
var tmpvec2 = new Float64Array(3);
|
|
35
32
|
var tmpvec3 = new Float64Array(3);
|
|
36
|
-
var rotateMatrix = identity(new Float64Array(16));
|
|
37
|
-
var trans = identity(new Float64Array(16));
|
|
33
|
+
var rotateMatrix = mat4.identity(new Float64Array(16));
|
|
34
|
+
var trans = mat4.identity(new Float64Array(16));
|
|
38
35
|
var newPosition = new Float64Array(3);
|
|
39
36
|
var newFocalPoint = new Float64Array(3); // Internal Functions that don't need to be public
|
|
40
37
|
|
|
@@ -143,10 +140,10 @@ function vtkCamera(publicAPI, model) {
|
|
|
143
140
|
var at = model.focalPoint;
|
|
144
141
|
var up = model.viewUp;
|
|
145
142
|
var viewUpVec4 = new Float64Array([up[0], up[1], up[2], 0.0]);
|
|
146
|
-
identity(rotateMatrix);
|
|
143
|
+
mat4.identity(rotateMatrix);
|
|
147
144
|
var viewDir = new Float64Array([at[0] - eye[0], at[1] - eye[1], at[2] - eye[2]]);
|
|
148
|
-
rotate(rotateMatrix, rotateMatrix, radiansFromDegrees(angle), viewDir);
|
|
149
|
-
transformMat4(viewUpVec4, viewUpVec4, rotateMatrix);
|
|
145
|
+
mat4.rotate(rotateMatrix, rotateMatrix, radiansFromDegrees(angle), viewDir);
|
|
146
|
+
vec4.transformMat4(viewUpVec4, viewUpVec4, rotateMatrix);
|
|
150
147
|
model.viewUp[0] = viewUpVec4[0];
|
|
151
148
|
model.viewUp[1] = viewUpVec4[1];
|
|
152
149
|
model.viewUp[2] = viewUpVec4[2];
|
|
@@ -155,29 +152,29 @@ function vtkCamera(publicAPI, model) {
|
|
|
155
152
|
|
|
156
153
|
publicAPI.azimuth = function (angle) {
|
|
157
154
|
var fp = model.focalPoint;
|
|
158
|
-
identity(trans); // translate the focal point to the origin,
|
|
155
|
+
mat4.identity(trans); // translate the focal point to the origin,
|
|
159
156
|
// rotate about view up,
|
|
160
157
|
// translate back again
|
|
161
158
|
|
|
162
|
-
translate(trans, trans, fp);
|
|
163
|
-
rotate(trans, trans, radiansFromDegrees(angle), model.viewUp);
|
|
164
|
-
translate(trans, trans, [-fp[0], -fp[1], -fp[2]]); // apply the transform to the position
|
|
159
|
+
mat4.translate(trans, trans, fp);
|
|
160
|
+
mat4.rotate(trans, trans, radiansFromDegrees(angle), model.viewUp);
|
|
161
|
+
mat4.translate(trans, trans, [-fp[0], -fp[1], -fp[2]]); // apply the transform to the position
|
|
165
162
|
|
|
166
|
-
transformMat4
|
|
163
|
+
vec3.transformMat4(newPosition, model.position, trans);
|
|
167
164
|
publicAPI.setPosition(newPosition[0], newPosition[1], newPosition[2]);
|
|
168
165
|
};
|
|
169
166
|
|
|
170
167
|
publicAPI.yaw = function (angle) {
|
|
171
168
|
var position = model.position;
|
|
172
|
-
identity(trans); // translate the camera to the origin,
|
|
169
|
+
mat4.identity(trans); // translate the camera to the origin,
|
|
173
170
|
// rotate about axis,
|
|
174
171
|
// translate back again
|
|
175
172
|
|
|
176
|
-
translate(trans, trans, position);
|
|
177
|
-
rotate(trans, trans, radiansFromDegrees(angle), model.viewUp);
|
|
178
|
-
translate(trans, trans, [-position[0], -position[1], -position[2]]); // apply the transform to the position
|
|
173
|
+
mat4.translate(trans, trans, position);
|
|
174
|
+
mat4.rotate(trans, trans, radiansFromDegrees(angle), model.viewUp);
|
|
175
|
+
mat4.translate(trans, trans, [-position[0], -position[1], -position[2]]); // apply the transform to the position
|
|
179
176
|
|
|
180
|
-
transformMat4
|
|
177
|
+
vec3.transformMat4(newFocalPoint, model.focalPoint, trans);
|
|
181
178
|
publicAPI.setFocalPoint(newFocalPoint[0], newFocalPoint[1], newFocalPoint[2]);
|
|
182
179
|
};
|
|
183
180
|
|
|
@@ -186,15 +183,15 @@ function vtkCamera(publicAPI, model) {
|
|
|
186
183
|
|
|
187
184
|
var vt = publicAPI.getViewMatrix();
|
|
188
185
|
var axis = [-vt[0], -vt[1], -vt[2]];
|
|
189
|
-
identity(trans); // translate the focal point to the origin,
|
|
186
|
+
mat4.identity(trans); // translate the focal point to the origin,
|
|
190
187
|
// rotate about view up,
|
|
191
188
|
// translate back again
|
|
192
189
|
|
|
193
|
-
translate(trans, trans, fp);
|
|
194
|
-
rotate(trans, trans, radiansFromDegrees(angle), axis);
|
|
195
|
-
translate(trans, trans, [-fp[0], -fp[1], -fp[2]]); // apply the transform to the position
|
|
190
|
+
mat4.translate(trans, trans, fp);
|
|
191
|
+
mat4.rotate(trans, trans, radiansFromDegrees(angle), axis);
|
|
192
|
+
mat4.translate(trans, trans, [-fp[0], -fp[1], -fp[2]]); // apply the transform to the position
|
|
196
193
|
|
|
197
|
-
transformMat4
|
|
194
|
+
vec3.transformMat4(newPosition, model.position, trans);
|
|
198
195
|
publicAPI.setPosition(newPosition[0], newPosition[1], newPosition[2]);
|
|
199
196
|
};
|
|
200
197
|
|
|
@@ -202,15 +199,15 @@ function vtkCamera(publicAPI, model) {
|
|
|
202
199
|
var position = model.position;
|
|
203
200
|
var vt = publicAPI.getViewMatrix();
|
|
204
201
|
var axis = [vt[0], vt[1], vt[2]];
|
|
205
|
-
identity(trans); // translate the camera to the origin,
|
|
202
|
+
mat4.identity(trans); // translate the camera to the origin,
|
|
206
203
|
// rotate about axis,
|
|
207
204
|
// translate back again
|
|
208
205
|
|
|
209
|
-
translate(trans, trans, position);
|
|
210
|
-
rotate(trans, trans, radiansFromDegrees(angle), axis);
|
|
211
|
-
translate(trans, trans, [-position[0], -position[1], -position[2]]); // apply the transform to the focal point
|
|
206
|
+
mat4.translate(trans, trans, position);
|
|
207
|
+
mat4.rotate(trans, trans, radiansFromDegrees(angle), axis);
|
|
208
|
+
mat4.translate(trans, trans, [-position[0], -position[1], -position[2]]); // apply the transform to the focal point
|
|
212
209
|
|
|
213
|
-
transformMat4
|
|
210
|
+
vec3.transformMat4(newFocalPoint, model.focalPoint, trans);
|
|
214
211
|
publicAPI.setFocalPoint.apply(publicAPI, _toConsumableArray(newFocalPoint));
|
|
215
212
|
};
|
|
216
213
|
|
|
@@ -236,7 +233,7 @@ function vtkCamera(publicAPI, model) {
|
|
|
236
233
|
publicAPI.modified();
|
|
237
234
|
};
|
|
238
235
|
|
|
239
|
-
publicAPI.applyTransform = function (transformMat4
|
|
236
|
+
publicAPI.applyTransform = function (transformMat4) {
|
|
240
237
|
var vuOld = [].concat(_toConsumableArray(model.viewUp), [1.0]);
|
|
241
238
|
var posNew = [];
|
|
242
239
|
var fpNew = [];
|
|
@@ -244,9 +241,9 @@ function vtkCamera(publicAPI, model) {
|
|
|
244
241
|
vuOld[0] += model.position[0];
|
|
245
242
|
vuOld[1] += model.position[1];
|
|
246
243
|
vuOld[2] += model.position[2];
|
|
247
|
-
transformMat4(posNew, [].concat(_toConsumableArray(model.position), [1.0]), transformMat4
|
|
248
|
-
transformMat4(fpNew, [].concat(_toConsumableArray(model.focalPoint), [1.0]), transformMat4
|
|
249
|
-
transformMat4(vuNew, vuOld, transformMat4
|
|
244
|
+
vec4.transformMat4(posNew, [].concat(_toConsumableArray(model.position), [1.0]), transformMat4);
|
|
245
|
+
vec4.transformMat4(fpNew, [].concat(_toConsumableArray(model.focalPoint), [1.0]), transformMat4);
|
|
246
|
+
vec4.transformMat4(vuNew, vuOld, transformMat4);
|
|
250
247
|
vuNew[0] -= posNew[0];
|
|
251
248
|
vuNew[1] -= posNew[1];
|
|
252
249
|
vuNew[2] -= posNew[2];
|
|
@@ -302,24 +299,24 @@ function vtkCamera(publicAPI, model) {
|
|
|
302
299
|
|
|
303
300
|
publicAPI.physicalOrientationToWorldDirection = function (ori) {
|
|
304
301
|
// push the x axis through the orientation quat
|
|
305
|
-
var oriq = fromValues(ori[0], ori[1], ori[2], ori[3]);
|
|
306
|
-
var coriq = create();
|
|
307
|
-
var qdir = fromValues(0.0, 0.0, 1.0, 0.0);
|
|
308
|
-
conjugate(coriq, oriq); // rotate the z axis by the quat
|
|
302
|
+
var oriq = quat.fromValues(ori[0], ori[1], ori[2], ori[3]);
|
|
303
|
+
var coriq = quat.create();
|
|
304
|
+
var qdir = quat.fromValues(0.0, 0.0, 1.0, 0.0);
|
|
305
|
+
quat.conjugate(coriq, oriq); // rotate the z axis by the quat
|
|
309
306
|
|
|
310
|
-
multiply(qdir, oriq, qdir);
|
|
311
|
-
multiply(qdir, qdir, coriq); // return the z axis in world coords
|
|
307
|
+
quat.multiply(qdir, oriq, qdir);
|
|
308
|
+
quat.multiply(qdir, qdir, coriq); // return the z axis in world coords
|
|
312
309
|
|
|
313
310
|
return [qdir[0], qdir[1], qdir[2]];
|
|
314
311
|
};
|
|
315
312
|
|
|
316
313
|
publicAPI.getPhysicalToWorldMatrix = function (result) {
|
|
317
314
|
publicAPI.getWorldToPhysicalMatrix(result);
|
|
318
|
-
invert(result, result);
|
|
315
|
+
mat4.invert(result, result);
|
|
319
316
|
};
|
|
320
317
|
|
|
321
318
|
publicAPI.getWorldToPhysicalMatrix = function (result) {
|
|
322
|
-
identity(result); // now the physical to vtk world rotation tform
|
|
319
|
+
mat4.identity(result); // now the physical to vtk world rotation tform
|
|
323
320
|
|
|
324
321
|
var physVRight = [3];
|
|
325
322
|
cross(model.physicalViewNorth, model.physicalViewUp, physVRight);
|
|
@@ -332,15 +329,15 @@ function vtkCamera(publicAPI, model) {
|
|
|
332
329
|
result[8] = -model.physicalViewNorth[0];
|
|
333
330
|
result[9] = -model.physicalViewNorth[1];
|
|
334
331
|
result[10] = -model.physicalViewNorth[2];
|
|
335
|
-
transpose(result, result);
|
|
336
|
-
set(tmpvec1, 1 / model.physicalScale, 1 / model.physicalScale, 1 / model.physicalScale);
|
|
337
|
-
scale(result, result, tmpvec1);
|
|
338
|
-
translate(result, result, model.physicalTranslation);
|
|
332
|
+
mat4.transpose(result, result);
|
|
333
|
+
vec3.set(tmpvec1, 1 / model.physicalScale, 1 / model.physicalScale, 1 / model.physicalScale);
|
|
334
|
+
mat4.scale(result, result, tmpvec1);
|
|
335
|
+
mat4.translate(result, result, model.physicalTranslation);
|
|
339
336
|
};
|
|
340
337
|
|
|
341
338
|
publicAPI.computeViewParametersFromViewMatrix = function (vmat) {
|
|
342
339
|
// invert to get view to world
|
|
343
|
-
invert(tmpMatrix, vmat); // note with glmatrix operations happen in
|
|
340
|
+
mat4.invert(tmpMatrix, vmat); // note with glmatrix operations happen in
|
|
344
341
|
// the reverse order
|
|
345
342
|
// mat.scale
|
|
346
343
|
// mat.translate
|
|
@@ -350,18 +347,18 @@ function vtkCamera(publicAPI, model) {
|
|
|
350
347
|
// then extract the params position, orientation
|
|
351
348
|
// push 0,0,0 through to get a translation
|
|
352
349
|
|
|
353
|
-
transformMat4
|
|
350
|
+
vec3.transformMat4(tmpvec1, origin, tmpMatrix);
|
|
354
351
|
publicAPI.computeDistance();
|
|
355
352
|
var oldDist = model.distance;
|
|
356
353
|
publicAPI.setPosition(tmpvec1[0], tmpvec1[1], tmpvec1[2]); // push basis vectors to get orientation
|
|
357
354
|
|
|
358
|
-
transformMat4
|
|
359
|
-
subtract(tmpvec2, tmpvec2, tmpvec1);
|
|
360
|
-
normalize(tmpvec2, tmpvec2);
|
|
355
|
+
vec3.transformMat4(tmpvec2, dopbasis, tmpMatrix);
|
|
356
|
+
vec3.subtract(tmpvec2, tmpvec2, tmpvec1);
|
|
357
|
+
vec3.normalize(tmpvec2, tmpvec2);
|
|
361
358
|
publicAPI.setDirectionOfProjection(tmpvec2[0], tmpvec2[1], tmpvec2[2]);
|
|
362
|
-
transformMat4
|
|
363
|
-
subtract(tmpvec3, tmpvec3, tmpvec1);
|
|
364
|
-
normalize(tmpvec3, tmpvec3);
|
|
359
|
+
vec3.transformMat4(tmpvec3, upbasis, tmpMatrix);
|
|
360
|
+
vec3.subtract(tmpvec3, tmpvec3, tmpvec1);
|
|
361
|
+
vec3.normalize(tmpvec3, tmpvec3);
|
|
365
362
|
publicAPI.setViewUp(tmpvec3[0], tmpvec3[1], tmpvec3[2]);
|
|
366
363
|
publicAPI.setDistance(oldDist);
|
|
367
364
|
}; // the provided matrix should include
|
|
@@ -374,7 +371,7 @@ function vtkCamera(publicAPI, model) {
|
|
|
374
371
|
publicAPI.getWorldToPhysicalMatrix(tmpMatrix); // first convert the physical -> view matrix to be
|
|
375
372
|
// world -> view
|
|
376
373
|
|
|
377
|
-
multiply
|
|
374
|
+
mat4.multiply(tmpMatrix, mat, tmpMatrix);
|
|
378
375
|
publicAPI.computeViewParametersFromViewMatrix(tmpMatrix);
|
|
379
376
|
};
|
|
380
377
|
|
|
@@ -382,9 +379,9 @@ function vtkCamera(publicAPI, model) {
|
|
|
382
379
|
model.viewMatrix = mat;
|
|
383
380
|
|
|
384
381
|
if (model.viewMatrix) {
|
|
385
|
-
copy(tmpMatrix, model.viewMatrix);
|
|
382
|
+
mat4.copy(tmpMatrix, model.viewMatrix);
|
|
386
383
|
publicAPI.computeViewParametersFromViewMatrix(tmpMatrix);
|
|
387
|
-
transpose(model.viewMatrix, model.viewMatrix);
|
|
384
|
+
mat4.transpose(model.viewMatrix, model.viewMatrix);
|
|
388
385
|
}
|
|
389
386
|
};
|
|
390
387
|
|
|
@@ -393,13 +390,13 @@ function vtkCamera(publicAPI, model) {
|
|
|
393
390
|
return model.viewMatrix;
|
|
394
391
|
}
|
|
395
392
|
|
|
396
|
-
lookAt(tmpMatrix, model.position, // eye
|
|
393
|
+
mat4.lookAt(tmpMatrix, model.position, // eye
|
|
397
394
|
model.focalPoint, // at
|
|
398
395
|
model.viewUp // up
|
|
399
396
|
);
|
|
400
|
-
transpose(tmpMatrix, tmpMatrix);
|
|
397
|
+
mat4.transpose(tmpMatrix, tmpMatrix);
|
|
401
398
|
var result = new Float64Array(16);
|
|
402
|
-
copy(result, tmpMatrix);
|
|
399
|
+
mat4.copy(result, tmpMatrix);
|
|
403
400
|
return result;
|
|
404
401
|
};
|
|
405
402
|
|
|
@@ -409,18 +406,18 @@ function vtkCamera(publicAPI, model) {
|
|
|
409
406
|
|
|
410
407
|
publicAPI.getProjectionMatrix = function (aspect, nearz, farz) {
|
|
411
408
|
var result = new Float64Array(16);
|
|
412
|
-
identity(result);
|
|
409
|
+
mat4.identity(result);
|
|
413
410
|
|
|
414
411
|
if (model.projectionMatrix) {
|
|
415
|
-
var scale
|
|
416
|
-
set(tmpvec1, scale
|
|
417
|
-
copy(result, model.projectionMatrix);
|
|
418
|
-
scale(result, result, tmpvec1);
|
|
419
|
-
transpose(result, result);
|
|
412
|
+
var scale = 1 / model.physicalScale;
|
|
413
|
+
vec3.set(tmpvec1, scale, scale, scale);
|
|
414
|
+
mat4.copy(result, model.projectionMatrix);
|
|
415
|
+
mat4.scale(result, result, tmpvec1);
|
|
416
|
+
mat4.transpose(result, result);
|
|
420
417
|
return result;
|
|
421
418
|
}
|
|
422
419
|
|
|
423
|
-
identity(tmpMatrix); // FIXME: Not sure what to do about adjust z buffer here
|
|
420
|
+
mat4.identity(tmpMatrix); // FIXME: Not sure what to do about adjust z buffer here
|
|
424
421
|
// adjust Z-buffer range
|
|
425
422
|
// this->ProjectionTransform->AdjustZBuffer( -1, +1, nearz, farz );
|
|
426
423
|
|
|
@@ -435,8 +432,8 @@ function vtkCamera(publicAPI, model) {
|
|
|
435
432
|
var xmax = (model.windowCenter[0] + 1.0) * width;
|
|
436
433
|
var ymin = (model.windowCenter[1] - 1.0) * height;
|
|
437
434
|
var ymax = (model.windowCenter[1] + 1.0) * height;
|
|
438
|
-
ortho(tmpMatrix, xmin, xmax, ymin, ymax, cRange[0], cRange[1]);
|
|
439
|
-
transpose(tmpMatrix, tmpMatrix);
|
|
435
|
+
mat4.ortho(tmpMatrix, xmin, xmax, ymin, ymax, cRange[0], cRange[1]);
|
|
436
|
+
mat4.transpose(tmpMatrix, tmpMatrix);
|
|
440
437
|
} else if (model.useOffAxisProjection) {
|
|
441
438
|
throw new Error('Off-Axis projection is not supported at this time');
|
|
442
439
|
} else {
|
|
@@ -474,7 +471,7 @@ function vtkCamera(publicAPI, model) {
|
|
|
474
471
|
tmpMatrix[15] = 0.0;
|
|
475
472
|
}
|
|
476
473
|
|
|
477
|
-
copy(result, tmpMatrix);
|
|
474
|
+
mat4.copy(result, tmpMatrix);
|
|
478
475
|
return result;
|
|
479
476
|
};
|
|
480
477
|
|
|
@@ -483,7 +480,7 @@ function vtkCamera(publicAPI, model) {
|
|
|
483
480
|
var pMat = publicAPI.getProjectionMatrix(aspect, nearz, farz); // mats are transposed so the order is A then B
|
|
484
481
|
// we reuse pMat as it is a copy so we can do what we want with it
|
|
485
482
|
|
|
486
|
-
multiply
|
|
483
|
+
mat4.multiply(pMat, vMat, pMat);
|
|
487
484
|
return pMat;
|
|
488
485
|
};
|
|
489
486
|
|
|
@@ -523,35 +520,35 @@ function vtkCamera(publicAPI, model) {
|
|
|
523
520
|
var physVRight = [3];
|
|
524
521
|
cross(model.physicalViewNorth, model.physicalViewUp, physVRight); // phone to physical coordinates
|
|
525
522
|
|
|
526
|
-
var rotmat = identity(new Float64Array(16));
|
|
527
|
-
rotate(rotmat, rotmat, radiansFromDegrees(alpha), model.physicalViewUp);
|
|
528
|
-
rotate(rotmat, rotmat, radiansFromDegrees(beta), physVRight);
|
|
529
|
-
rotate(rotmat, rotmat, radiansFromDegrees(gamma), model.physicalViewNorth);
|
|
530
|
-
rotate(rotmat, rotmat, radiansFromDegrees(-screen), model.physicalViewUp);
|
|
523
|
+
var rotmat = mat4.identity(new Float64Array(16));
|
|
524
|
+
mat4.rotate(rotmat, rotmat, radiansFromDegrees(alpha), model.physicalViewUp);
|
|
525
|
+
mat4.rotate(rotmat, rotmat, radiansFromDegrees(beta), physVRight);
|
|
526
|
+
mat4.rotate(rotmat, rotmat, radiansFromDegrees(gamma), model.physicalViewNorth);
|
|
527
|
+
mat4.rotate(rotmat, rotmat, radiansFromDegrees(-screen), model.physicalViewUp);
|
|
531
528
|
var dop = new Float64Array([-model.physicalViewUp[0], -model.physicalViewUp[1], -model.physicalViewUp[2]]);
|
|
532
529
|
var vup = new Float64Array(model.physicalViewNorth);
|
|
533
|
-
transformMat4
|
|
534
|
-
transformMat4
|
|
530
|
+
vec3.transformMat4(dop, dop, rotmat);
|
|
531
|
+
vec3.transformMat4(vup, vup, rotmat);
|
|
535
532
|
publicAPI.setDirectionOfProjection(dop[0], dop[1], dop[2]);
|
|
536
533
|
publicAPI.setViewUp(vup[0], vup[1], vup[2]);
|
|
537
534
|
publicAPI.modified();
|
|
538
535
|
};
|
|
539
536
|
|
|
540
537
|
publicAPI.setOrientationWXYZ = function (degrees, x, y, z) {
|
|
541
|
-
var quatMat = identity(new Float64Array(16));
|
|
538
|
+
var quatMat = mat4.identity(new Float64Array(16));
|
|
542
539
|
|
|
543
540
|
if (degrees !== 0.0 && (x !== 0.0 || y !== 0.0 || z !== 0.0)) {
|
|
544
541
|
// convert to radians
|
|
545
542
|
var angle = radiansFromDegrees(degrees);
|
|
546
|
-
var q = create();
|
|
547
|
-
setAxisAngle(q, [x, y, z], angle);
|
|
548
|
-
fromQuat(quatMat, q);
|
|
543
|
+
var q = quat.create();
|
|
544
|
+
quat.setAxisAngle(q, [x, y, z], angle);
|
|
545
|
+
mat4.fromQuat(quatMat, q);
|
|
549
546
|
}
|
|
550
547
|
|
|
551
548
|
var newdop = new Float64Array(3);
|
|
552
|
-
transformMat4
|
|
549
|
+
vec3.transformMat4(newdop, [0.0, 0.0, -1.0], quatMat);
|
|
553
550
|
var newvup = new Float64Array(3);
|
|
554
|
-
transformMat4
|
|
551
|
+
vec3.transformMat4(newvup, [0.0, 1.0, 0.0], quatMat);
|
|
555
552
|
publicAPI.setDirectionOfProjection.apply(publicAPI, _toConsumableArray(newdop));
|
|
556
553
|
publicAPI.setViewUp.apply(publicAPI, _toConsumableArray(newvup));
|
|
557
554
|
publicAPI.modified();
|
|
@@ -4,7 +4,7 @@ import { l as normalize } from '../../Common/Core/Math/index.js';
|
|
|
4
4
|
import vtkPicker from './Picker.js';
|
|
5
5
|
import vtkPoints from '../../Common/Core/Points.js';
|
|
6
6
|
import vtkTriangle from '../../Common/DataModel/Triangle.js';
|
|
7
|
-
import {
|
|
7
|
+
import { vec3 } from 'gl-matrix';
|
|
8
8
|
|
|
9
9
|
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
10
|
|
|
@@ -198,7 +198,7 @@ function vtkCellPicker(publicAPI, model) {
|
|
|
198
198
|
model.mapperNormal[2] = -plane[2];
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
transformMat4(model.pickPosition, model.mapperPosition, model.transformMatrix); // Transform vector
|
|
201
|
+
vec3.transformMat4(model.pickPosition, model.mapperPosition, model.transformMatrix); // Transform vector
|
|
202
202
|
|
|
203
203
|
var mat = model.transformMatrix;
|
|
204
204
|
model.mapperNormal[0] = mat[0] * model.pickNormal[0] + mat[4] * model.pickNormal[1] + mat[8] * model.pickNormal[2];
|