Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | 1x | import macro from 'vtk.js/Sources/macros'; import vtkMatrixBuilder from 'vtk.js/Sources/Common/Core/MatrixBuilder'; // ---------------------------------------------------------------------------- function vtkDirectionMixin(publicAPI, model) { const transform = model.angleUnit === 'degree' ? vtkMatrixBuilder.buildFromDegree() : vtkMatrixBuilder.buildFromRadian(); publicAPI.rotateFromDirections = (originDirection, targetDirection) => { transform .identity() .rotateFromDirections(originDirection, targetDirection) .apply(model.direction); publicAPI.modified(); }; publicAPI.rotate = (angle, axis) => { transform.identity().rotate(angle, axis).apply(model.direction); }; publicAPI.rotateX = (angle) => { transform.identity().rotateX(angle).apply(model.direction); }; publicAPI.rotateY = (angle) => { transform.identity().rotateY(angle).apply(model.direction); }; publicAPI.rotateZ = (angle) => { transform.identity().rotateZ(angle).apply(model.direction); }; } // ---------------------------------------------------------------------------- const DEFAULT_VALUES = { direction: [1, 0, 0], }; // ---------------------------------------------------------------------------- export function extend(publicAPI, model, initialValues = {}) { Object.assign(model, DEFAULT_VALUES, initialValues); macro.setGetArray(publicAPI, model, ['direction'], 3); vtkDirectionMixin(publicAPI, model); } // ---------------------------------------------------------------------------- export default { extend }; |