@kitware/vtk.js 34.12.0 → 34.13.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/CellArray.d.ts +5 -0
- package/Common/Core/CellArray.js +1 -0
- package/Common/Core/Math/index.js +1 -1
- package/Common/Core/Math.d.ts +2 -1
- package/Common/Core/Math.js +1 -1
- package/Common/Core/MatrixBuilder.d.ts +1 -0
- package/Common/DataModel/BoundingBox.js +1 -0
- package/Common/DataModel/DataSet.js +57 -32
- package/Common/DataModel/DataSetAttributes/FieldData.js +2 -2
- package/Common/DataModel/ImageData.js +1 -1
- package/Common/DataModel/IncrementalOctreeNode.js +1 -1
- package/Common/DataModel/IncrementalOctreePointLocator.js +1 -1
- package/Common/DataModel/Line.js +1 -1
- package/Common/DataModel/MergePoints.js +2 -2
- package/Common/DataModel/Planes.js +1 -1
- package/Common/DataModel/PointLocator.js +1 -1
- package/Common/DataModel/PolyData.d.ts +9 -3
- package/Common/DataModel/PolyData.js +10 -1
- package/Common/DataModel/Polygon.js +1 -1
- package/Common/DataModel/Quad.js +1 -1
- package/Common/DataModel/Triangle.js +1 -1
- package/Common/Transform/Transform.d.ts +1 -0
- package/Common/Transform/Transform.js +1 -1
- package/Filters/Core/CleanPolyData.d.ts +208 -0
- package/Filters/Core/CleanPolyData.js +399 -0
- package/Filters/Core/PolyDataNormals.js +1 -1
- package/Filters/Core/ThresholdPoints.js +2 -2
- package/Filters/Core.js +5 -1
- package/Filters/General/ClipClosedSurface.js +1 -1
- package/Filters/General/ContourTriangulator/helper.js +1 -1
- package/Filters/General/TubeFilter.js +1 -1
- package/Filters/General/WindowedSincPolyDataFilter.js +1 -1
- package/Filters/Sources/ArcSource.js +1 -1
- package/Filters/Sources/EllipseArcSource.js +1 -1
- package/Filters/Sources/FrustumSource.js +1 -1
- package/Filters/Texture/TextureMapToPlane.js +1 -1
- package/Filters/Texture/TextureMapToSphere.js +1 -1
- package/Imaging/Core/ImageReslice.d.ts +2 -1
- package/Imaging/Core/ImageReslice.js +1 -1
- package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +1 -1
- package/Interaction/Style/InteractorStyleMPRSlice.js +1 -1
- package/Rendering/Core/CellPicker.js +1 -1
- package/Rendering/Core/Mapper.js +2 -2
- package/Rendering/Core/Mapper2D.js +2 -2
- package/Rendering/Core/Picker.js +1 -1
- package/Rendering/Core/Renderer.js +13 -11
- package/Rendering/OpenGL/ImageResliceMapper.js +1 -1
- package/Rendering/WebGPU/VolumePass.js +1 -1
- package/Widgets/Core/StateBuilder/originMixin.js +1 -1
- package/Widgets/Core/WidgetManager.js +1 -1
- package/Widgets/Widgets3D/LineWidget.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget.js +1 -1
- package/Widgets/Widgets3D/ShapeWidget/behavior.js +1 -1
- package/Widgets/Widgets3D/SphereWidget.js +1 -1
- package/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
import { m as macro } from '../../macros2.js';
|
|
2
|
+
import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
|
|
3
|
+
import vtkCellArray from '../../Common/Core/CellArray.js';
|
|
4
|
+
import vtkMergePoints from '../../Common/DataModel/MergePoints.js';
|
|
5
|
+
import vtkPointLocator from '../../Common/DataModel/PointLocator.js';
|
|
6
|
+
import vtkPoints from '../../Common/Core/Points.js';
|
|
7
|
+
import vtkPolyData from '../../Common/DataModel/PolyData.js';
|
|
8
|
+
import { DesiredOutputPrecision } from '../../Common/DataModel/DataSetAttributes/Constants.js';
|
|
9
|
+
import { VtkDataTypes } from '../../Common/Core/DataArray/Constants.js';
|
|
10
|
+
|
|
11
|
+
// ----------------------------------------------------------------------------
|
|
12
|
+
// vtkCleanPolyData methods
|
|
13
|
+
// ----------------------------------------------------------------------------
|
|
14
|
+
|
|
15
|
+
function vtkCleanPolyData(publicAPI, model) {
|
|
16
|
+
// Set our classname
|
|
17
|
+
model.classHierarchy.push('vtkCleanPolyData');
|
|
18
|
+
const tempX = [];
|
|
19
|
+
|
|
20
|
+
// Point processing
|
|
21
|
+
function processPoint(ptId, inPts, newPts, inputPD, outputPD, pointMap, numUsedPts) {
|
|
22
|
+
const newX = [0, 0, 0];
|
|
23
|
+
inPts.getPoint(ptId, tempX);
|
|
24
|
+
publicAPI.operateOnPoint(tempX, newX);
|
|
25
|
+
if (!model.pointMerging) {
|
|
26
|
+
if (pointMap[ptId] === -1) {
|
|
27
|
+
pointMap[ptId] = numUsedPts.value++;
|
|
28
|
+
newPts.setPoint(pointMap[ptId], newX);
|
|
29
|
+
outputPD.passData(inputPD, ptId, pointMap[ptId]);
|
|
30
|
+
}
|
|
31
|
+
return pointMap[ptId];
|
|
32
|
+
}
|
|
33
|
+
const newPtId = model._locator.insertUniquePoint(newX).id;
|
|
34
|
+
if (!model.copiedPoints.has(newPtId)) {
|
|
35
|
+
model.copiedPoints.add(newPtId);
|
|
36
|
+
outputPD.passData(inputPD, ptId, newPtId);
|
|
37
|
+
}
|
|
38
|
+
return newPtId;
|
|
39
|
+
}
|
|
40
|
+
publicAPI.operateOnPoint = (inPt, outPt) => {
|
|
41
|
+
outPt[0] = inPt[0];
|
|
42
|
+
outPt[1] = inPt[1];
|
|
43
|
+
outPt[2] = inPt[2];
|
|
44
|
+
};
|
|
45
|
+
publicAPI.operateOnBounds = (inBounds, outBounds) => {
|
|
46
|
+
vtkBoundingBox.setBounds(outBounds, inBounds);
|
|
47
|
+
};
|
|
48
|
+
publicAPI.createDefaultLocator = input => {
|
|
49
|
+
let tol;
|
|
50
|
+
if (model.toleranceIsAbsolute) {
|
|
51
|
+
tol = model.absoluteTolerance;
|
|
52
|
+
} else if (input) {
|
|
53
|
+
tol = model.tolerance * input.getLength();
|
|
54
|
+
} else {
|
|
55
|
+
tol = model.tolerance;
|
|
56
|
+
}
|
|
57
|
+
if (!model._locator) {
|
|
58
|
+
model._locator = tol === 0.0 ? vtkMergePoints.newInstance() : vtkPointLocator.newInstance();
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (tol === 0.0 && model._locator?.getTolerance() !== 0.0) {
|
|
62
|
+
model._locator = vtkMergePoints.newInstance();
|
|
63
|
+
} else if (tol > 0.0 && !(model._locator?.getTolerance() > 0.0)) {
|
|
64
|
+
model._locator = vtkPointLocator.newInstance();
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
publicAPI.requestData = (inData, outData) => {
|
|
68
|
+
const input = inData[0];
|
|
69
|
+
const output = outData[0]?.initialize() || vtkPolyData.newInstance();
|
|
70
|
+
outData[0] = output;
|
|
71
|
+
const inPts = input.getPoints();
|
|
72
|
+
const numPts = input.getNumberOfPoints();
|
|
73
|
+
if (!inPts || numPts < 1) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const updatedPts = new Array(input.getMaxCellSize());
|
|
77
|
+
const numUsedPts = {
|
|
78
|
+
value: 0
|
|
79
|
+
};
|
|
80
|
+
const precision = model.outputPointsPrecision;
|
|
81
|
+
let pointType = inPts.getDataType();
|
|
82
|
+
if (precision) {
|
|
83
|
+
pointType = precision === DesiredOutputPrecision.DOUBLE ? VtkDataTypes.DOUBLE : VtkDataTypes.FLOAT;
|
|
84
|
+
}
|
|
85
|
+
const newPts = vtkPoints.newInstance({
|
|
86
|
+
dataType: pointType
|
|
87
|
+
});
|
|
88
|
+
const inVerts = input.getVerts();
|
|
89
|
+
const inLines = input.getLines();
|
|
90
|
+
const inPolys = input.getPolys();
|
|
91
|
+
const inStrips = input.getStrips();
|
|
92
|
+
let newVerts = null;
|
|
93
|
+
let newLines = null;
|
|
94
|
+
let newPolys = null;
|
|
95
|
+
let newStrips = null;
|
|
96
|
+
const inputPD = input.getPointData();
|
|
97
|
+
const inputCD = input.getCellData();
|
|
98
|
+
const outputPD = output.getPointData();
|
|
99
|
+
const outputCD = output.getCellData();
|
|
100
|
+
let pointMap = null;
|
|
101
|
+
if (model.pointMerging) {
|
|
102
|
+
publicAPI.createDefaultLocator(input);
|
|
103
|
+
if (model.toleranceIsAbsolute) {
|
|
104
|
+
model._locator.setTolerance(model.absoluteTolerance);
|
|
105
|
+
} else {
|
|
106
|
+
model._locator.setTolerance(model.tolerance * input.getLength());
|
|
107
|
+
}
|
|
108
|
+
const originalBounds = input.getBounds();
|
|
109
|
+
const mappedBounds = [];
|
|
110
|
+
publicAPI.operateOnBounds(originalBounds, mappedBounds);
|
|
111
|
+
model._locator.initPointInsertion(newPts, mappedBounds);
|
|
112
|
+
} else {
|
|
113
|
+
pointMap = new Array(numPts).fill(-1);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Copy data attributes setup
|
|
117
|
+
outputPD.copyStructure(inputPD);
|
|
118
|
+
outputCD.copyStructure(inputCD);
|
|
119
|
+
model.copiedPoints.clear();
|
|
120
|
+
let outLineData = null;
|
|
121
|
+
let outPolyData = null;
|
|
122
|
+
let outStrpData = null;
|
|
123
|
+
let vertIDcounter = 0;
|
|
124
|
+
let lineIDcounter = 0;
|
|
125
|
+
let polyIDcounter = 0;
|
|
126
|
+
let strpIDcounter = 0;
|
|
127
|
+
|
|
128
|
+
// Process vertices
|
|
129
|
+
let inCellID = 0;
|
|
130
|
+
if (inVerts && inVerts.getNumberOfCells() > 0) {
|
|
131
|
+
newVerts = vtkCellArray.newInstance();
|
|
132
|
+
let currentIdx = 0;
|
|
133
|
+
const cellData = inVerts.getData();
|
|
134
|
+
while (currentIdx < cellData.length) {
|
|
135
|
+
const npts = cellData[currentIdx++];
|
|
136
|
+
const inputPointIds = cellData.slice(currentIdx, currentIdx + npts);
|
|
137
|
+
currentIdx += npts;
|
|
138
|
+
let numNewPts = 0;
|
|
139
|
+
for (let i = 0; i < inputPointIds.length; i++) {
|
|
140
|
+
const ptId = inputPointIds[i];
|
|
141
|
+
const newPtId = processPoint(ptId, inPts, newPts, inputPD, outputPD, pointMap, numUsedPts);
|
|
142
|
+
updatedPts[numNewPts++] = newPtId;
|
|
143
|
+
}
|
|
144
|
+
if (numNewPts > 0) {
|
|
145
|
+
newVerts.insertNextCell(updatedPts.slice(0, numNewPts));
|
|
146
|
+
outputCD.passData(inputCD, inCellID, vertIDcounter);
|
|
147
|
+
vertIDcounter++;
|
|
148
|
+
}
|
|
149
|
+
inCellID++;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Process lines
|
|
154
|
+
if (inLines && inLines.getNumberOfCells() > 0) {
|
|
155
|
+
newLines = vtkCellArray.newInstance();
|
|
156
|
+
let currentIdx = 0;
|
|
157
|
+
const cellData = inLines.getData();
|
|
158
|
+
while (currentIdx < cellData.length) {
|
|
159
|
+
const npts = cellData[currentIdx++];
|
|
160
|
+
const inputPointIds = cellData.slice(currentIdx, currentIdx + npts);
|
|
161
|
+
currentIdx += npts;
|
|
162
|
+
let numNewPts = 0;
|
|
163
|
+
for (let i = 0; i < inputPointIds.length; i++) {
|
|
164
|
+
const ptId = inputPointIds[i];
|
|
165
|
+
const newPtId = processPoint(ptId, inPts, newPts, inputPD, outputPD, pointMap, numUsedPts);
|
|
166
|
+
if (i === 0 || newPtId !== updatedPts[numNewPts - 1]) {
|
|
167
|
+
updatedPts[numNewPts++] = newPtId;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (numNewPts >= 2) {
|
|
171
|
+
newLines.insertNextCell(updatedPts.slice(0, numNewPts));
|
|
172
|
+
if (!outLineData) {
|
|
173
|
+
outLineData = [];
|
|
174
|
+
}
|
|
175
|
+
outLineData.push({
|
|
176
|
+
inputId: inCellID,
|
|
177
|
+
outputId: lineIDcounter
|
|
178
|
+
});
|
|
179
|
+
lineIDcounter++;
|
|
180
|
+
} else if (numNewPts === 1 && (inputPointIds.length === numNewPts || model.convertLinesToPoints)) {
|
|
181
|
+
if (!newVerts) {
|
|
182
|
+
newVerts = vtkCellArray.newInstance();
|
|
183
|
+
}
|
|
184
|
+
newVerts.insertNextCell(updatedPts.slice(0, numNewPts));
|
|
185
|
+
outputCD.passData(inputCD, inCellID, vertIDcounter);
|
|
186
|
+
vertIDcounter++;
|
|
187
|
+
}
|
|
188
|
+
inCellID++;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Process polygons
|
|
193
|
+
if (inPolys && inPolys.getNumberOfCells() > 0) {
|
|
194
|
+
newPolys = vtkCellArray.newInstance();
|
|
195
|
+
let currentIdx = 0;
|
|
196
|
+
const cellData = inPolys.getData();
|
|
197
|
+
while (currentIdx < cellData.length) {
|
|
198
|
+
const npts = cellData[currentIdx++];
|
|
199
|
+
const inputPointIds = cellData.slice(currentIdx, currentIdx + npts);
|
|
200
|
+
currentIdx += npts;
|
|
201
|
+
let numNewPts = 0;
|
|
202
|
+
for (let i = 0; i < inputPointIds.length; i++) {
|
|
203
|
+
const ptId = inputPointIds[i];
|
|
204
|
+
const newPtId = processPoint(ptId, inPts, newPts, inputPD, outputPD, pointMap, numUsedPts);
|
|
205
|
+
if (i === 0 || newPtId !== updatedPts[numNewPts - 1]) {
|
|
206
|
+
updatedPts[numNewPts++] = newPtId;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Remove duplicate last point if it matches first
|
|
211
|
+
if (numNewPts > 2 && updatedPts[0] === updatedPts[numNewPts - 1]) {
|
|
212
|
+
numNewPts--;
|
|
213
|
+
}
|
|
214
|
+
if (numNewPts > 2) {
|
|
215
|
+
newPolys.insertNextCell(updatedPts.slice(0, numNewPts));
|
|
216
|
+
if (!outPolyData) {
|
|
217
|
+
outPolyData = [];
|
|
218
|
+
}
|
|
219
|
+
outPolyData.push({
|
|
220
|
+
inputId: inCellID,
|
|
221
|
+
outputId: polyIDcounter
|
|
222
|
+
});
|
|
223
|
+
polyIDcounter++;
|
|
224
|
+
} else if (numNewPts === 2 && (inputPointIds.length === numNewPts || model.convertPolysToLines)) {
|
|
225
|
+
if (!newLines) {
|
|
226
|
+
newLines = vtkCellArray.newInstance();
|
|
227
|
+
outLineData = [];
|
|
228
|
+
}
|
|
229
|
+
newLines.insertNextCell(updatedPts.slice(0, numNewPts));
|
|
230
|
+
outLineData.push({
|
|
231
|
+
inputId: inCellID,
|
|
232
|
+
outputId: lineIDcounter
|
|
233
|
+
});
|
|
234
|
+
lineIDcounter++;
|
|
235
|
+
} else if (numNewPts === 1 && (inputPointIds.length === numNewPts || model.convertLinesToPoints)) {
|
|
236
|
+
if (!newVerts) {
|
|
237
|
+
newVerts = vtkCellArray.newInstance();
|
|
238
|
+
}
|
|
239
|
+
newVerts.insertNextCell(updatedPts.slice(0, numNewPts));
|
|
240
|
+
outputCD.passData(inputCD, inCellID, vertIDcounter);
|
|
241
|
+
vertIDcounter++;
|
|
242
|
+
}
|
|
243
|
+
inCellID++;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Process triangle strips
|
|
248
|
+
if (inStrips && inStrips.getNumberOfCells() > 0) {
|
|
249
|
+
newStrips = vtkCellArray.newInstance();
|
|
250
|
+
let currentIdx = 0;
|
|
251
|
+
const cellData = inStrips.getData();
|
|
252
|
+
while (currentIdx < cellData.length) {
|
|
253
|
+
const npts = cellData[currentIdx++];
|
|
254
|
+
const inputPointIds = cellData.slice(currentIdx, currentIdx + npts);
|
|
255
|
+
currentIdx += npts;
|
|
256
|
+
let numNewPts = 0;
|
|
257
|
+
for (let i = 0; i < inputPointIds.length; i++) {
|
|
258
|
+
const ptId = inputPointIds[i];
|
|
259
|
+
const newPtId = processPoint(ptId, inPts, newPts, inputPD, outputPD, pointMap, numUsedPts);
|
|
260
|
+
if (i === 0 || newPtId !== updatedPts[numNewPts - 1]) {
|
|
261
|
+
updatedPts[numNewPts++] = newPtId;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// Remove duplicate last point if it matches first
|
|
266
|
+
if (numNewPts > 1 && updatedPts[0] === updatedPts[numNewPts - 1]) {
|
|
267
|
+
numNewPts--;
|
|
268
|
+
}
|
|
269
|
+
if (numNewPts > 3) {
|
|
270
|
+
newStrips.insertNextCell(updatedPts.slice(0, numNewPts));
|
|
271
|
+
if (!outStrpData) {
|
|
272
|
+
outStrpData = [];
|
|
273
|
+
}
|
|
274
|
+
outStrpData.push({
|
|
275
|
+
inputId: inCellID,
|
|
276
|
+
outputId: strpIDcounter
|
|
277
|
+
});
|
|
278
|
+
strpIDcounter++;
|
|
279
|
+
} else if (numNewPts === 3 && (inputPointIds.length === numNewPts || model.convertStripsToPolys)) {
|
|
280
|
+
if (!newPolys) {
|
|
281
|
+
newPolys = vtkCellArray.newInstance();
|
|
282
|
+
outPolyData = [];
|
|
283
|
+
}
|
|
284
|
+
newPolys.insertNextCell(updatedPts.slice(0, numNewPts));
|
|
285
|
+
outPolyData.push({
|
|
286
|
+
inputId: inCellID,
|
|
287
|
+
outputId: polyIDcounter
|
|
288
|
+
});
|
|
289
|
+
polyIDcounter++;
|
|
290
|
+
} else if (numNewPts === 2 && (inputPointIds.length === numNewPts || model.convertPolysToLines)) {
|
|
291
|
+
if (!newLines) {
|
|
292
|
+
newLines = vtkCellArray.newInstance();
|
|
293
|
+
outLineData = [];
|
|
294
|
+
}
|
|
295
|
+
newLines.insertNextCell(updatedPts.slice(0, numNewPts));
|
|
296
|
+
outLineData.push({
|
|
297
|
+
inputId: inCellID,
|
|
298
|
+
outputId: lineIDcounter
|
|
299
|
+
});
|
|
300
|
+
lineIDcounter++;
|
|
301
|
+
} else if (numNewPts === 1 && (inputPointIds.length === numNewPts || model.convertLinesToPoints)) {
|
|
302
|
+
if (!newVerts) {
|
|
303
|
+
newVerts = vtkCellArray.newInstance();
|
|
304
|
+
}
|
|
305
|
+
newVerts.insertNextCell(updatedPts.slice(0, numNewPts));
|
|
306
|
+
outputCD.passData(inputCD, inCellID, vertIDcounter);
|
|
307
|
+
vertIDcounter++;
|
|
308
|
+
}
|
|
309
|
+
inCellID++;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// Clean up
|
|
314
|
+
if (model.pointMerging) {
|
|
315
|
+
model._locator.initialize();
|
|
316
|
+
} else {
|
|
317
|
+
newPts.setNumberOfPoints(numUsedPts.value);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// Copy cell data in correct order
|
|
321
|
+
let combinedCellID = vertIDcounter;
|
|
322
|
+
if (outLineData) {
|
|
323
|
+
outLineData.forEach(item => {
|
|
324
|
+
outputCD.passData(inputCD, item.inputId, combinedCellID);
|
|
325
|
+
combinedCellID++;
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
if (outPolyData) {
|
|
329
|
+
outPolyData.forEach(item => {
|
|
330
|
+
outputCD.passData(inputCD, item.inputId, combinedCellID);
|
|
331
|
+
combinedCellID++;
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
if (outStrpData) {
|
|
335
|
+
outStrpData.forEach(item => {
|
|
336
|
+
outputCD.passData(inputCD, item.inputId, combinedCellID);
|
|
337
|
+
combinedCellID++;
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// Set output
|
|
342
|
+
output.setPoints(newPts);
|
|
343
|
+
if (newVerts) output.setVerts(newVerts);
|
|
344
|
+
if (newLines) output.setLines(newLines);
|
|
345
|
+
if (newPolys) output.setPolys(newPolys);
|
|
346
|
+
if (newStrips) output.setStrips(newStrips);
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// ----------------------------------------------------------------------------
|
|
351
|
+
// Object factory
|
|
352
|
+
// ----------------------------------------------------------------------------
|
|
353
|
+
|
|
354
|
+
const DEFAULT_VALUES = {
|
|
355
|
+
pointMerging: true,
|
|
356
|
+
toleranceIsAbsolute: false,
|
|
357
|
+
tolerance: 0.0,
|
|
358
|
+
absoluteTolerance: 1.0,
|
|
359
|
+
convertLinesToPoints: true,
|
|
360
|
+
convertPolysToLines: true,
|
|
361
|
+
convertStripsToPolys: true,
|
|
362
|
+
locator: null,
|
|
363
|
+
outputPointsPrecision: DesiredOutputPrecision.DEFAULT
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
// ----------------------------------------------------------------------------
|
|
367
|
+
|
|
368
|
+
function extend(publicAPI, model) {
|
|
369
|
+
let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
370
|
+
Object.assign(model, DEFAULT_VALUES, initialValues);
|
|
371
|
+
|
|
372
|
+
// Make this a VTK object
|
|
373
|
+
macro.obj(publicAPI, model);
|
|
374
|
+
|
|
375
|
+
// Also make it an algorithm with one input and one output
|
|
376
|
+
macro.algo(publicAPI, model, 1, 1);
|
|
377
|
+
|
|
378
|
+
// Generate macros for properties
|
|
379
|
+
macro.setGet(publicAPI, model, ['pointMerging', 'toleranceIsAbsolute', 'tolerance', 'absoluteTolerance', 'convertPolysToLines', 'convertLinesToPoints', 'convertStripsToPolys', 'outputPointsPrecision']);
|
|
380
|
+
|
|
381
|
+
// Internal state
|
|
382
|
+
model.copiedPoints = new Set();
|
|
383
|
+
|
|
384
|
+
// Object methods
|
|
385
|
+
vtkCleanPolyData(publicAPI, model);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// ----------------------------------------------------------------------------
|
|
389
|
+
|
|
390
|
+
const newInstance = macro.newInstance(extend, 'vtkCleanPolyData');
|
|
391
|
+
|
|
392
|
+
// ----------------------------------------------------------------------------
|
|
393
|
+
|
|
394
|
+
var vtkCleanPolyData$1 = {
|
|
395
|
+
newInstance,
|
|
396
|
+
extend
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
export { vtkCleanPolyData$1 as default, extend, newInstance };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { m as macro } from '../../macros2.js';
|
|
2
2
|
import vtkDataArray from '../../Common/Core/DataArray.js';
|
|
3
|
-
import {
|
|
3
|
+
import { b as vtkMath } from '../../Common/Core/Math/index.js';
|
|
4
4
|
import vtkPolyData from '../../Common/DataModel/PolyData.js';
|
|
5
5
|
import vtkTriangle from '../../Common/DataModel/Triangle.js';
|
|
6
6
|
|
|
@@ -209,10 +209,10 @@ const newInstance = macro.newInstance(extend, 'vtkThresholdPoints');
|
|
|
209
209
|
|
|
210
210
|
// ----------------------------------------------------------------------------
|
|
211
211
|
|
|
212
|
-
var
|
|
212
|
+
var vtkThresholdPoints$1 = {
|
|
213
213
|
newInstance,
|
|
214
214
|
extend,
|
|
215
215
|
OperationType
|
|
216
216
|
};
|
|
217
217
|
|
|
218
|
-
export {
|
|
218
|
+
export { vtkThresholdPoints$1 as default, extend, newInstance };
|
package/Filters/Core.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import vtkCleanPolyData from './Core/CleanPolyData.js';
|
|
1
2
|
import vtkCutter from './Core/Cutter.js';
|
|
2
3
|
import vtkPolyDataNormals from './Core/PolyDataNormals.js';
|
|
4
|
+
import vtkThresholdPoints from './Core/ThresholdPoints.js';
|
|
3
5
|
|
|
4
6
|
var Core = {
|
|
7
|
+
vtkCleanPolyData,
|
|
5
8
|
vtkCutter,
|
|
6
|
-
vtkPolyDataNormals
|
|
9
|
+
vtkPolyDataNormals,
|
|
10
|
+
vtkThresholdPoints
|
|
7
11
|
};
|
|
8
12
|
|
|
9
13
|
export { Core as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { m as macro } from '../../macros2.js';
|
|
2
|
-
import { d as dot,
|
|
2
|
+
import { d as dot, f as distance2BetweenPoints } from '../../Common/Core/Math/index.js';
|
|
3
3
|
import vtkCellArray from '../../Common/Core/CellArray.js';
|
|
4
4
|
import vtkDataArray from '../../Common/Core/DataArray.js';
|
|
5
5
|
import { VtkDataTypes } from '../../Common/Core/DataArray/Constants.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { m as macro } from '../../../macros2.js';
|
|
2
2
|
import vtkPoints from '../../../Common/Core/Points.js';
|
|
3
|
-
import { s as subtract, j as cross, d as dot, n as norm,
|
|
3
|
+
import { s as subtract, j as cross, d as dot, n as norm, f as distance2BetweenPoints, k as add, l as normalize } from '../../../Common/Core/Math/index.js';
|
|
4
4
|
import vtkLine from '../../../Common/DataModel/Line.js';
|
|
5
5
|
import vtkPolygon from '../../../Common/DataModel/Polygon.js';
|
|
6
6
|
import vtkIncrementalOctreePointLocator from '../../../Common/DataModel/IncrementalOctreePointLocator.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { m as macro } from '../../macros2.js';
|
|
2
2
|
import vtkCellArray from '../../Common/Core/CellArray.js';
|
|
3
3
|
import vtkDataArray from '../../Common/Core/DataArray.js';
|
|
4
|
-
import { l as normalize, j as cross, n as norm, d as dot,
|
|
4
|
+
import { l as normalize, j as cross, n as norm, d as dot, f as distance2BetweenPoints } from '../../Common/Core/Math/index.js';
|
|
5
5
|
import vtkPoints from '../../Common/Core/Points.js';
|
|
6
6
|
import vtkPolyData from '../../Common/DataModel/PolyData.js';
|
|
7
7
|
import { DesiredOutputPrecision } from '../../Common/DataModel/DataSetAttributes/Constants.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { m as macro } from '../../macros2.js';
|
|
2
2
|
import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
|
|
3
3
|
import vtkDataArray from '../../Common/Core/DataArray.js';
|
|
4
|
-
import {
|
|
4
|
+
import { b as vtkMath } from '../../Common/Core/Math/index.js';
|
|
5
5
|
import { AttributeTypes } from '../../Common/DataModel/DataSetAttributes/Constants.js';
|
|
6
6
|
import vtkPoints from '../../Common/Core/Points.js';
|
|
7
7
|
import vtkPolyData from '../../Common/DataModel/PolyData.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { m as macro } from '../../macros2.js';
|
|
2
2
|
import vtkCellArray from '../../Common/Core/CellArray.js';
|
|
3
3
|
import vtkDataArray from '../../Common/Core/DataArray.js';
|
|
4
|
-
import {
|
|
4
|
+
import { b as vtkMath } from '../../Common/Core/Math/index.js';
|
|
5
5
|
import vtkPoints from '../../Common/Core/Points.js';
|
|
6
6
|
import vtkPolyData from '../../Common/DataModel/PolyData.js';
|
|
7
7
|
import { DesiredOutputPrecision } from '../../Common/DataModel/DataSetAttributes/Constants.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { m as macro } from '../../macros2.js';
|
|
2
2
|
import vtkCellArray from '../../Common/Core/CellArray.js';
|
|
3
3
|
import vtkDataArray from '../../Common/Core/DataArray.js';
|
|
4
|
-
import {
|
|
4
|
+
import { b as vtkMath } from '../../Common/Core/Math/index.js';
|
|
5
5
|
import vtkPoints from '../../Common/Core/Points.js';
|
|
6
6
|
import vtkPolyData from '../../Common/DataModel/PolyData.js';
|
|
7
7
|
import { DesiredOutputPrecision } from '../../Common/DataModel/DataSetAttributes/Constants.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { m as macro } from '../../macros2.js';
|
|
2
|
-
import {
|
|
2
|
+
import { b as vtkMath } from '../../Common/Core/Math/index.js';
|
|
3
3
|
import vtkCellArray from '../../Common/Core/CellArray.js';
|
|
4
4
|
import vtkPoints from '../../Common/Core/Points.js';
|
|
5
5
|
import vtkPolyData from '../../Common/DataModel/PolyData.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { m as macro } from '../../macros2.js';
|
|
2
2
|
import vtkDataArray from '../../Common/Core/DataArray.js';
|
|
3
|
-
import { l as normalize, d as dot, j as cross,
|
|
3
|
+
import { l as normalize, d as dot, j as cross, f as distance2BetweenPoints, z as determinant3x3, A as rowsToMat3 } from '../../Common/Core/Math/index.js';
|
|
4
4
|
import vtkPolyData from '../../Common/DataModel/PolyData.js';
|
|
5
5
|
|
|
6
6
|
const {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { m as macro } from '../../macros2.js';
|
|
2
2
|
import vtkDataArray from '../../Common/Core/DataArray.js';
|
|
3
|
-
import {
|
|
3
|
+
import { f as distance2BetweenPoints } from '../../Common/Core/Math/index.js';
|
|
4
4
|
import vtkPolyData from '../../Common/DataModel/PolyData.js';
|
|
5
5
|
|
|
6
6
|
const {
|
|
@@ -666,7 +666,8 @@ export function newInstance(
|
|
|
666
666
|
* slice rather than a volume. You can use both the resliceAxes and the
|
|
667
667
|
* resliceTransform at the same time, in order to extract slices from a
|
|
668
668
|
* volume that you have applied a transformation to.
|
|
669
|
-
*
|
|
669
|
+
* **Note**: vtkImageReslice uses column-major format.
|
|
670
|
+
*/
|
|
670
671
|
export declare const vtkImageReslice: {
|
|
671
672
|
newInstance: typeof newInstance;
|
|
672
673
|
extend: typeof extend;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mat4, vec4 } from 'gl-matrix';
|
|
2
2
|
import { m as macro, v as vtkWarningMacro } from '../../macros2.js';
|
|
3
3
|
import vtkDataArray from '../../Common/Core/DataArray.js';
|
|
4
|
-
import {
|
|
4
|
+
import { b as vtkMath } from '../../Common/Core/Math/index.js';
|
|
5
5
|
import vtkMatrixBuilder from '../../Common/Core/MatrixBuilder.js';
|
|
6
6
|
import { VtkDataTypes } from '../../Common/Core/DataArray/Constants.js';
|
|
7
7
|
import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
|
|
@@ -8,7 +8,7 @@ import vtkSphereSource from '../../Filters/Sources/SphereSource.js';
|
|
|
8
8
|
import { FieldAssociations } from '../../Common/DataModel/DataSet/Constants.js';
|
|
9
9
|
import { mat4, vec3 } from 'gl-matrix';
|
|
10
10
|
import { m as macro } from '../../macros2.js';
|
|
11
|
-
import { E as areEquals, l as normalize, d as dot, F as clampValue, s as subtract, j as cross, x as multiplyScalar,
|
|
11
|
+
import { E as areEquals, l as normalize, d as dot, F as clampValue, s as subtract, j as cross, x as multiplyScalar, f as distance2BetweenPoints } from '../../Common/Core/Math/index.js';
|
|
12
12
|
|
|
13
13
|
const {
|
|
14
14
|
States
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { m as macro } from '../../macros2.js';
|
|
2
|
-
import { l as normalize, E as areEquals,
|
|
2
|
+
import { l as normalize, E as areEquals, f as distance2BetweenPoints } from '../../Common/Core/Math/index.js';
|
|
3
3
|
import vtkMatrixBuilder from '../../Common/Core/MatrixBuilder.js';
|
|
4
4
|
import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
|
|
5
5
|
import vtkInteractorStyleManipulator from './InteractorStyleManipulator.js';
|
|
@@ -5,7 +5,7 @@ import vtkPicker from './Picker.js';
|
|
|
5
5
|
import vtkPolyLine from '../../Common/DataModel/PolyLine.js';
|
|
6
6
|
import vtkTriangle from '../../Common/DataModel/Triangle.js';
|
|
7
7
|
import vtkQuad from '../../Common/DataModel/Quad.js';
|
|
8
|
-
import { l as normalize,
|
|
8
|
+
import { l as normalize, f as distance2BetweenPoints } from '../../Common/Core/Math/index.js';
|
|
9
9
|
import { CellType } from '../../Common/DataModel/CellTypes/Constants.js';
|
|
10
10
|
import { vec3, vec4 } from 'gl-matrix';
|
|
11
11
|
import vtkBox from '../../Common/DataModel/Box.js';
|
package/Rendering/Core/Mapper.js
CHANGED
|
@@ -193,12 +193,12 @@ function getOrCreateColorTextureCoordinates(input, component, range, useLogScale
|
|
|
193
193
|
if (useMagnitude) {
|
|
194
194
|
let sum = 0;
|
|
195
195
|
for (let compIdx = 0; compIdx < numComps; ++compIdx) {
|
|
196
|
-
const compValue = inputV[inputIdx + compIdx];
|
|
196
|
+
const compValue = Number(inputV[inputIdx + compIdx]);
|
|
197
197
|
sum += compValue * compValue;
|
|
198
198
|
}
|
|
199
199
|
scalarValue = Math.sqrt(sum);
|
|
200
200
|
} else {
|
|
201
|
-
scalarValue = inputV[inputIdx + component];
|
|
201
|
+
scalarValue = Number(inputV[inputIdx + component]);
|
|
202
202
|
}
|
|
203
203
|
if (useLogScale) {
|
|
204
204
|
scalarValue = Math.log10(scalarValue);
|
|
@@ -176,12 +176,12 @@ function getOrCreateColorTextureCoordinates(input, component, range, useLogScale
|
|
|
176
176
|
if (useMagnitude) {
|
|
177
177
|
let sum = 0;
|
|
178
178
|
for (let compIdx = 0; compIdx < numComps; ++compIdx) {
|
|
179
|
-
const compValue = inputV[inputIdx + compIdx];
|
|
179
|
+
const compValue = Number(inputV[inputIdx + compIdx]);
|
|
180
180
|
sum += compValue * compValue;
|
|
181
181
|
}
|
|
182
182
|
scalarValue = Math.sqrt(sum);
|
|
183
183
|
} else {
|
|
184
|
-
scalarValue = inputV[inputIdx + component];
|
|
184
|
+
scalarValue = Number(inputV[inputIdx + component]);
|
|
185
185
|
}
|
|
186
186
|
if (useLogScale) {
|
|
187
187
|
scalarValue = Math.log10(scalarValue);
|
package/Rendering/Core/Picker.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { m as macro } from '../../macros2.js';
|
|
2
2
|
import vtkAbstractPicker from './AbstractPicker.js';
|
|
3
3
|
import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
|
|
4
|
-
import { d as dot, l as normalize, s as subtract,
|
|
4
|
+
import { d as dot, l as normalize, s as subtract, f as distance2BetweenPoints } from '../../Common/Core/Math/index.js';
|
|
5
5
|
import { vec3, mat4, vec4 } from 'gl-matrix';
|
|
6
6
|
|
|
7
7
|
const {
|
|
@@ -362,17 +362,19 @@ function vtkRenderer(publicAPI, model) {
|
|
|
362
362
|
|
|
363
363
|
// default so that the bounding sphere fits within the view fustrum
|
|
364
364
|
|
|
365
|
-
//
|
|
366
|
-
//
|
|
367
|
-
//
|
|
368
|
-
//
|
|
369
|
-
//
|
|
370
|
-
//
|
|
371
|
-
//
|
|
372
|
-
//
|
|
373
|
-
//
|
|
374
|
-
// the
|
|
375
|
-
//
|
|
365
|
+
// Viewing the scene from the side in 2D:
|
|
366
|
+
// Draw a circle representing the bounding sphere containing all pixels.
|
|
367
|
+
// Then, draw a horizontal line going out from the center of the circle.
|
|
368
|
+
// The camera is somewhere on this line.
|
|
369
|
+
// Picture the view frustrum, moving through the circle.
|
|
370
|
+
// Draw a line from the intersection of the view frustrum and the bounding sphere to line the camera is on, ensuring that the line is tangent to the circle.
|
|
371
|
+
// Draw the radius from the tangent point to the center of the circle.
|
|
372
|
+
// You will note that this forms a right triangle with sides:
|
|
373
|
+
// - radius
|
|
374
|
+
// - the line formed by the intersection of the view frustrum and the bounding sphere
|
|
375
|
+
// - the target distance for the camera.
|
|
376
|
+
// We can use trigonometry to solve for that distance.
|
|
377
|
+
|
|
376
378
|
const angle = radiansFromDegrees(model.activeCamera.getViewAngle());
|
|
377
379
|
const parallelScale = radius;
|
|
378
380
|
const distance = radius / Math.sin(angle * 0.5);
|
|
@@ -5,7 +5,7 @@ import vtkCutter from '../../Filters/Core/Cutter.js';
|
|
|
5
5
|
import vtkDataArray from '../../Common/Core/DataArray.js';
|
|
6
6
|
import vtkHelper from './Helper.js';
|
|
7
7
|
import vtkImageDataOutlineFilter from '../../Filters/General/ImageDataOutlineFilter.js';
|
|
8
|
-
import {
|
|
8
|
+
import { b as vtkMath } from '../../Common/Core/Math/index.js';
|
|
9
9
|
import vtkOpenGLTexture from './Texture.js';
|
|
10
10
|
import vtkPlane from '../../Common/DataModel/Plane.js';
|
|
11
11
|
import vtkPolyData from '../../Common/DataModel/PolyData.js';
|