@kitware/vtk.js 24.1.0 → 24.2.0
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/DataModel/BoundingBox.js +29 -7
- package/Rendering/Core/CubeAxesActor.js +18 -2
- package/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -165,6 +165,30 @@ function _scale(bounds, sx, sy, sz) {
|
|
|
165
165
|
function _getCenter(bounds) {
|
|
166
166
|
return [0.5 * (bounds[0] + bounds[1]), 0.5 * (bounds[2] + bounds[3]), 0.5 * (bounds[4] + bounds[5])];
|
|
167
167
|
}
|
|
168
|
+
function scaleAboutCenter(bounds, sx, sy, sz) {
|
|
169
|
+
if (!_isValid(bounds)) {
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
var center = _getCenter(bounds);
|
|
174
|
+
|
|
175
|
+
bounds[0] -= center[0];
|
|
176
|
+
bounds[1] -= center[0];
|
|
177
|
+
bounds[2] -= center[1];
|
|
178
|
+
bounds[3] -= center[1];
|
|
179
|
+
bounds[4] -= center[2];
|
|
180
|
+
bounds[5] -= center[2];
|
|
181
|
+
|
|
182
|
+
_scale(bounds, sx, sy, sz);
|
|
183
|
+
|
|
184
|
+
bounds[0] += center[0];
|
|
185
|
+
bounds[1] += center[0];
|
|
186
|
+
bounds[2] += center[1];
|
|
187
|
+
bounds[3] += center[1];
|
|
188
|
+
bounds[4] += center[2];
|
|
189
|
+
bounds[5] += center[2];
|
|
190
|
+
return true;
|
|
191
|
+
}
|
|
168
192
|
|
|
169
193
|
function _getLength(bounds, index) {
|
|
170
194
|
return bounds[index * 2 + 1] - bounds[index * 2];
|
|
@@ -253,12 +277,9 @@ function _computeCornerPoints(bounds, point1, point2) {
|
|
|
253
277
|
|
|
254
278
|
function _computeScale(bounds) {
|
|
255
279
|
var scale3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
scale3[0] = bounds[1] - center[0];
|
|
260
|
-
scale3[1] = bounds[3] - center[1];
|
|
261
|
-
scale3[2] = bounds[5] - center[2];
|
|
280
|
+
scale3[0] = 0.5 * (bounds[1] - bounds[0]);
|
|
281
|
+
scale3[1] = 0.5 * (bounds[3] - bounds[2]);
|
|
282
|
+
scale3[2] = 0.5 * (bounds[5] - bounds[4]);
|
|
262
283
|
return scale3;
|
|
263
284
|
}
|
|
264
285
|
|
|
@@ -756,6 +777,7 @@ var STATIC = {
|
|
|
756
777
|
setMaxPoint: _setMaxPoint,
|
|
757
778
|
inflate: _inflate,
|
|
758
779
|
scale: _scale,
|
|
780
|
+
scaleAboutCenter: scaleAboutCenter,
|
|
759
781
|
getCenter: _getCenter,
|
|
760
782
|
getLength: _getLength,
|
|
761
783
|
getLengths: _getLengths,
|
|
@@ -783,4 +805,4 @@ var vtkBoundingBox = _objectSpread({
|
|
|
783
805
|
newInstance: newInstance
|
|
784
806
|
}, STATIC);
|
|
785
807
|
|
|
786
|
-
export { STATIC, _addBounds as addBounds, _addPoint as addPoint, _computeCornerPoints as computeCornerPoints, _computeLocalBounds as computeLocalBounds, _computeScale as computeScale3, contains, _containsPoint as containsPoint, _cutWithPlane as cutWithPlane, vtkBoundingBox as default, _equals as equals, _getCenter as getCenter, _getCorners as getCorners, _getDiagonalLength as getDiagonalLength, _getLength as getLength, _getLengths as getLengths, _getMaxLength as getMaxLength, _getMaxPoint as getMaxPoint, _getMinPoint as getMinPoint, _getXRange as getXRange, _getYRange as getYRange, _getZRange as getZRange, _inflate as inflate, _intersect as intersect, _intersectBox as intersectBox, _intersectPlane as intersectPlane, _intersects as intersects, _isValid as isValid, _reset as reset, _scale as scale, _setBounds as setBounds, _setMaxPoint as setMaxPoint, _setMinPoint as setMinPoint };
|
|
808
|
+
export { STATIC, _addBounds as addBounds, _addPoint as addPoint, _computeCornerPoints as computeCornerPoints, _computeLocalBounds as computeLocalBounds, _computeScale as computeScale3, contains, _containsPoint as containsPoint, _cutWithPlane as cutWithPlane, vtkBoundingBox as default, _equals as equals, _getCenter as getCenter, _getCorners as getCorners, _getDiagonalLength as getDiagonalLength, _getLength as getLength, _getLengths as getLengths, _getMaxLength as getMaxLength, _getMaxPoint as getMaxPoint, _getMinPoint as getMinPoint, _getXRange as getXRange, _getYRange as getYRange, _getZRange as getZRange, _inflate as inflate, _intersect as intersect, _intersectBox as intersectBox, _intersectPlane as intersectPlane, _intersects as intersects, _isValid as isValid, _reset as reset, _scale as scale, scaleAboutCenter, _setBounds as setBounds, _setMaxPoint as setMaxPoint, _setMinPoint as setMinPoint };
|
|
@@ -684,6 +684,21 @@ function vtkCubeAxesActor(publicAPI, model) {
|
|
|
684
684
|
model.axisTextStyle = _objectSpread(_objectSpread({}, model.axisTextStyle), axisStyle);
|
|
685
685
|
publicAPI.modified();
|
|
686
686
|
};
|
|
687
|
+
|
|
688
|
+
publicAPI.get_tmAtlas = function () {
|
|
689
|
+
return model._tmAtlas;
|
|
690
|
+
}; // try to get the bounds for the annotation. This is complicated
|
|
691
|
+
// as it relies on the pixel size of the window. Every time the camera
|
|
692
|
+
// changes the bounds change. This method simplifies by just expanding
|
|
693
|
+
// the grid bounds by a user specified factor.
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
publicAPI.getBounds = function () {
|
|
697
|
+
publicAPI.update();
|
|
698
|
+
vtkBoundingBox.setBounds(model.bounds, model.gridActor.getBounds());
|
|
699
|
+
vtkBoundingBox.scaleAboutCenter(model.bounds, model.boundsScaleFactor);
|
|
700
|
+
return model.bounds;
|
|
701
|
+
};
|
|
687
702
|
} // ----------------------------------------------------------------------------
|
|
688
703
|
// Object factory
|
|
689
704
|
// ----------------------------------------------------------------------------
|
|
@@ -691,6 +706,7 @@ function vtkCubeAxesActor(publicAPI, model) {
|
|
|
691
706
|
|
|
692
707
|
function defaultValues(initialValues) {
|
|
693
708
|
return _objectSpread({
|
|
709
|
+
boundsScaleFactor: 1.3,
|
|
694
710
|
camera: null,
|
|
695
711
|
dataBounds: _toConsumableArray(vtkBoundingBox.INIT_BOUNDS),
|
|
696
712
|
faceVisibilityAngle: 8,
|
|
@@ -741,10 +757,10 @@ function extend(publicAPI, model) {
|
|
|
741
757
|
model.gridActor.setProperty(publicAPI.getProperty());
|
|
742
758
|
model.gridActor.setParentProp(publicAPI);
|
|
743
759
|
model.textPolyData = vtkPolyData.newInstance();
|
|
744
|
-
macro.setGet(publicAPI, model, ['axisTitlePixelOffset', 'faceVisibilityAngle', 'gridLines', 'tickLabelPixelOffset']);
|
|
760
|
+
macro.setGet(publicAPI, model, ['axisTitlePixelOffset', 'boundsScaleFactor', 'faceVisibilityAngle', 'gridLines', 'tickLabelPixelOffset']);
|
|
745
761
|
macro.setGetArray(publicAPI, model, ['dataBounds'], 6);
|
|
746
762
|
macro.setGetArray(publicAPI, model, ['axisLabels'], 3);
|
|
747
|
-
macro.get(publicAPI, model, ['axisTextStyle', 'tickTextStyle', 'camera', 'tmTexture', 'textValues', 'textPolyData', '
|
|
763
|
+
macro.get(publicAPI, model, ['axisTextStyle', 'tickTextStyle', 'camera', 'tmTexture', 'textValues', 'textPolyData', 'tickCounts', 'gridActor']); // Object methods
|
|
748
764
|
|
|
749
765
|
vtkCubeAxesActor(publicAPI, model);
|
|
750
766
|
} // ----------------------------------------------------------------------------
|
package/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
/// <reference path="./interfaces.d.ts" />
|
|
3
3
|
/// <reference path="./macros.d.ts" />
|
|
4
4
|
/// <reference path="./vtk.d.ts" />
|
|
5
|
-
/// <reference path="./Common/Core/Base64.d.ts" />
|
|
6
5
|
/// <reference path="./Common/Core/CellArray.d.ts" />
|
|
6
|
+
/// <reference path="./Common/Core/Base64.d.ts" />
|
|
7
7
|
/// <reference path="./Common/Core/DataArray.d.ts" />
|
|
8
8
|
/// <reference path="./Common/Core/Endian.d.ts" />
|
|
9
9
|
/// <reference path="./Common/Core/HalfFloat.d.ts" />
|