@kitware/vtk.js 34.5.0 → 34.6.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/Core/CellArray.d.ts +3 -0
- package/Common/Core/CellArray.js +12 -1
- package/Common/Core/DataArray.d.ts +15 -0
- package/Common/Core/DataArray.js +8 -4
- package/Common/Core/Math/index.js +1 -1
- package/Common/Core/Math.js +1 -1
- package/Common/DataModel/Triangle.d.ts +68 -19
- package/Common/DataModel/Triangle.js +140 -1
- package/Common/DataModel/TriangleStrip.d.ts +180 -0
- package/Common/DataModel/TriangleStrip.js +396 -0
- package/Common/DataModel.js +3 -1
- package/Common/Transform/LandmarkTransform.js +1 -1
- package/Common/Transform/Transform.d.ts +112 -1
- package/Common/Transform/Transform.js +301 -2
- package/Filters/Core/Cutter.js +41 -0
- package/Filters/General/OBBTree.js +1 -1
- package/Filters/General/TransformPolyDataFilter.d.ts +75 -0
- package/Filters/General/TransformPolyDataFilter.js +194 -0
- package/Filters/General.js +2 -0
- package/Filters/Sources/CircleSource.js +1 -1
- package/Filters/Sources/PointSource.js +1 -1
- package/Filters/Texture/TextureMapToPlane.js +1 -1
- package/IO/Geometry/DracoReader.js +1 -1
- package/IO/Geometry/GLTFImporter/Animations.js +1 -1
- package/IO/Geometry/GLTFImporter/Reader.js +2 -2
- package/IO/Image/HDRReader/Utils.js +1 -1
- package/IO/Image/HDRReader.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraUnicamManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +1 -1
- package/Interaction/Style/InteractorStyleTrackballCamera.js +1 -1
- package/Interaction/Widgets/PiecewiseGaussianWidget.js +1 -1
- package/Proxy/Core/View2DProxy.js +1 -1
- package/Rendering/Core/AbstractImageMapper.js +1 -1
- package/Rendering/Core/AbstractMapper3D.js +1 -1
- package/Rendering/Core/ColorTransferFunction/CssFilters.js +1 -1
- package/Rendering/Core/ColorTransferFunction.js +1 -1
- package/Rendering/Core/Coordinate.js +1 -1
- package/Rendering/Core/CubeAxesActor.js +1 -1
- package/Rendering/Core/Glyph3DMapper.js +1 -1
- package/Rendering/Core/ImageArrayMapper.js +1 -1
- package/Rendering/Core/ImageMapper.js +1 -1
- package/Rendering/Core/Mapper.js +1 -1
- package/Rendering/Core/Prop3D.js +1 -1
- package/Rendering/Core/RenderWindowInteractor.js +3 -3
- package/Rendering/Core/Renderer.js +1 -1
- package/Rendering/Core/ScalarBarActor.js +1 -1
- package/Rendering/Core/TextActor.js +1 -1
- package/Rendering/Core/VectorText/Utils.js +1 -1
- package/Rendering/Core/VolumeProperty.js +1 -1
- package/Rendering/OpenGL/PolyDataMapper2D.js +1 -1
- package/Rendering/OpenGL/Texture.js +1 -1
- package/Rendering/OpenGL/VolumeMapper.js +21 -19
- package/Widgets/Manipulators/LineManipulator.js +1 -1
- package/Widgets/Representations/PolyLineRepresentation.js +1 -1
- package/Widgets/Widgets3D/AngleWidget.js +1 -1
- package/Widgets/Widgets3D/LineWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget.js +1 -1
- package/index.d.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import { m as macro } from '../../macros2.js';
|
|
2
|
+
import vtkCell from './Cell.js';
|
|
3
|
+
import vtkLine from './Line.js';
|
|
4
|
+
import vtkTriangle from './Triangle.js';
|
|
5
|
+
import { CellType } from './CellTypes/Constants.js';
|
|
6
|
+
|
|
7
|
+
const {
|
|
8
|
+
vtkErrorMacro
|
|
9
|
+
} = macro;
|
|
10
|
+
|
|
11
|
+
// ----------------------------------------------------------------------------
|
|
12
|
+
// Global methods
|
|
13
|
+
// ----------------------------------------------------------------------------
|
|
14
|
+
|
|
15
|
+
function notImplemented(method) {
|
|
16
|
+
return () => vtkErrorMacro(`vtkTriangleStrip.${method} - NOT IMPLEMENTED`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Decomposes a triangle strip into individual triangles.
|
|
21
|
+
* @param {*} pts Points of the triangle strip
|
|
22
|
+
* @param {*} polys Cell array to store the resulting triangles
|
|
23
|
+
*/
|
|
24
|
+
function decomposeStrip(pts, polys) {
|
|
25
|
+
if (!Array.isArray(pts) || pts.length < 3) {
|
|
26
|
+
vtkErrorMacro('decomposeStrip - Invalid points array');
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
let p1 = pts[0];
|
|
30
|
+
let p2 = pts[1];
|
|
31
|
+
for (let i = 0; i < pts.length - 2; i++) {
|
|
32
|
+
const p3 = pts[i + 2];
|
|
33
|
+
if (i % 2) {
|
|
34
|
+
// Flip ordering to preserve consistency
|
|
35
|
+
polys.insertNextCell([p2, p1, p3]);
|
|
36
|
+
} else {
|
|
37
|
+
polys.insertNextCell([p1, p2, p3]);
|
|
38
|
+
}
|
|
39
|
+
p1 = p2;
|
|
40
|
+
p2 = p3;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// ----------------------------------------------------------------------------
|
|
45
|
+
// Static API
|
|
46
|
+
// ----------------------------------------------------------------------------
|
|
47
|
+
|
|
48
|
+
const STATIC = {
|
|
49
|
+
decomposeStrip
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// ----------------------------------------------------------------------------
|
|
53
|
+
// vtkTriangleStrip methods
|
|
54
|
+
// ----------------------------------------------------------------------------
|
|
55
|
+
|
|
56
|
+
function vtkTriangleStrip(publicAPI, model) {
|
|
57
|
+
// Set our className
|
|
58
|
+
model.classHierarchy.push('vtkTriangleStrip');
|
|
59
|
+
const superInitialize = publicAPI.initialize;
|
|
60
|
+
publicAPI.initialize = (points, pointsIds) => {
|
|
61
|
+
model.triangle.initialize(points, pointsIds);
|
|
62
|
+
superInitialize(points, pointsIds);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Get the cell type.
|
|
67
|
+
* @returns {number} Cell type
|
|
68
|
+
*/
|
|
69
|
+
publicAPI.getCellType = () => CellType.VTK_TRIANGLE_STRIP;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Get the cell dimension.
|
|
73
|
+
* The dimension of a triangle strip is always 2.
|
|
74
|
+
* @returns {number} Cell dimension
|
|
75
|
+
*/
|
|
76
|
+
publicAPI.getCellDimension = () => 2;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Get the number of edges.
|
|
80
|
+
* @returns {number} Number of edges
|
|
81
|
+
*/
|
|
82
|
+
publicAPI.getNumberOfEdges = () => model.pointsIds.length;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Get the number of faces.
|
|
86
|
+
* @returns {number} Number of faces
|
|
87
|
+
*/
|
|
88
|
+
publicAPI.getNumberOfFaces = () => 0;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Evaluate the position within the triangle strip.
|
|
92
|
+
* @param {*} x Intersection point
|
|
93
|
+
* @param {*} closestPoint Closest point on the triangle
|
|
94
|
+
* @param {*} pcoords Parametric coordinates
|
|
95
|
+
* @param {*} dist2 Squared distance to the closest point
|
|
96
|
+
* @param {*} weights Weights for interpolation
|
|
97
|
+
* @returns {number} Evaluation status
|
|
98
|
+
*/
|
|
99
|
+
publicAPI.evaluatePosition = (x, closestPoint, pcoords, dist2, weights) => {
|
|
100
|
+
const pc = [0, 0, 0];
|
|
101
|
+
let minDist2 = Number.MAX_VALUE;
|
|
102
|
+
let returnStatus = 0;
|
|
103
|
+
const tempWeights = [];
|
|
104
|
+
const activeWeights = [];
|
|
105
|
+
const closest = [];
|
|
106
|
+
pcoords[2] = 0.0;
|
|
107
|
+
activeWeights[0] = 0.0;
|
|
108
|
+
activeWeights[1] = 0.0;
|
|
109
|
+
activeWeights[2] = 0.0;
|
|
110
|
+
const points = model.triangle.getPoints();
|
|
111
|
+
points.setNumberOfPoints(3);
|
|
112
|
+
const pointsIds = model.triangle.getPointsIds();
|
|
113
|
+
const numPoints = pointsIds.length;
|
|
114
|
+
|
|
115
|
+
// Initialize weights
|
|
116
|
+
for (let i = 0; i < numPoints; i++) {
|
|
117
|
+
weights[i] = 0.0;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Iterate through triangles in the strip
|
|
121
|
+
for (let i = 0; i < numPoints - 2; i++) {
|
|
122
|
+
// Set triangle points
|
|
123
|
+
const pt0 = [];
|
|
124
|
+
points.getPoint(i, pt0);
|
|
125
|
+
const pt1 = [];
|
|
126
|
+
points.getPoint(i + 1, pt1);
|
|
127
|
+
const pt2 = [];
|
|
128
|
+
points.getPoint(i + 2, pt2);
|
|
129
|
+
points.setData(Float32Array.from([...pt0, ...pt1, ...pt2]), 3);
|
|
130
|
+
|
|
131
|
+
// Use dist2 from triangle's evaluatePosition return value
|
|
132
|
+
const status = model.triangle.evaluatePosition(x, closest, pc, tempWeights);
|
|
133
|
+
const currentDist2 = status.dist2;
|
|
134
|
+
if (status.evaluation >= 0 && (currentDist2 < minDist2 || currentDist2 === minDist2 && returnStatus === 0)) {
|
|
135
|
+
returnStatus = status;
|
|
136
|
+
if (closestPoint) {
|
|
137
|
+
closestPoint[0] = closest[0];
|
|
138
|
+
closestPoint[1] = closest[1];
|
|
139
|
+
closestPoint[2] = closest[2];
|
|
140
|
+
}
|
|
141
|
+
pcoords[0] = pc[0];
|
|
142
|
+
pcoords[1] = pc[1];
|
|
143
|
+
minDist2 = currentDist2;
|
|
144
|
+
activeWeights[0] = tempWeights[0];
|
|
145
|
+
activeWeights[1] = tempWeights[1];
|
|
146
|
+
activeWeights[2] = tempWeights[2];
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
dist2[0] = minDist2;
|
|
150
|
+
weights[0] = activeWeights[0];
|
|
151
|
+
weights[1] = activeWeights[1];
|
|
152
|
+
weights[2] = activeWeights[2];
|
|
153
|
+
return returnStatus;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Evaluate the location within the triangle strip.
|
|
158
|
+
* @param {*} subId Sub-Id of the triangle
|
|
159
|
+
* @param {*} pcoords Parametric coordinates
|
|
160
|
+
* @param {*} x Intersection point
|
|
161
|
+
* @param {*} weights Weights for interpolation
|
|
162
|
+
*/
|
|
163
|
+
publicAPI.evaluateLocation = (subId, pcoords, x, weights) => {
|
|
164
|
+
const idx = [[0, 1, 2], [1, 0, 2]];
|
|
165
|
+
const order = subId % 2;
|
|
166
|
+
const numPoints = model.pointsIds.length;
|
|
167
|
+
|
|
168
|
+
// Initialize weights
|
|
169
|
+
for (let i = 0; i < numPoints; i++) {
|
|
170
|
+
weights[i] = 0.0;
|
|
171
|
+
}
|
|
172
|
+
const u3 = 1.0 - pcoords[0] - pcoords[1];
|
|
173
|
+
weights[subId] = u3;
|
|
174
|
+
weights[subId + 1] = pcoords[0];
|
|
175
|
+
weights[subId + 2] = pcoords[1];
|
|
176
|
+
|
|
177
|
+
// Get points
|
|
178
|
+
const pt1 = [];
|
|
179
|
+
model.points.getPoint(subId + idx[order][0], pt1);
|
|
180
|
+
const pt2 = [];
|
|
181
|
+
model.points.getPoint(subId + idx[order][1], pt2);
|
|
182
|
+
const pt3 = [];
|
|
183
|
+
model.points.getPoint(subId + idx[order][2], pt3);
|
|
184
|
+
|
|
185
|
+
// Interpolate position
|
|
186
|
+
for (let i = 0; i < 3; i++) {
|
|
187
|
+
x[i] = pt1[i] * weights[subId] + pt2[i] * weights[subId + 1] + pt3[i] * weights[subId + 2];
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Get the cell boundary of the triangle strip.
|
|
193
|
+
* @param {Number} subId The sub-id of the cell.
|
|
194
|
+
* @param {Vector3} pcoords The parametric coordinates.
|
|
195
|
+
* @param {Vector2} pts The points of the cell.
|
|
196
|
+
*/
|
|
197
|
+
publicAPI.cellBoundary = (subId, pcoords, pts) => {
|
|
198
|
+
const idx = [[0, 1, 2], [1, 0, 2]];
|
|
199
|
+
const order = subId % 2;
|
|
200
|
+
const pointsIds = model.triangle.getPointsIds();
|
|
201
|
+
pointsIds[0] = model.pointsIds[idx[order][0]];
|
|
202
|
+
pointsIds[1] = model.pointsIds[idx[order][1]];
|
|
203
|
+
pointsIds[2] = model.pointsIds[idx[order][2]];
|
|
204
|
+
return model.triangle.cellBoundary(0, pcoords, pts);
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Get the edge of the triangle strip.
|
|
209
|
+
* @param {Number} edgeId Edge index (0 to n-1)
|
|
210
|
+
* @returns {vtkLine} The edge as a vtkLine instance
|
|
211
|
+
*/
|
|
212
|
+
publicAPI.getEdge = edgeId => {
|
|
213
|
+
let id1;
|
|
214
|
+
let id2;
|
|
215
|
+
const numPoints = model.pointsIds.length;
|
|
216
|
+
if (edgeId === 0) {
|
|
217
|
+
id1 = 0;
|
|
218
|
+
id2 = 1;
|
|
219
|
+
} else if (edgeId === numPoints - 1) {
|
|
220
|
+
id1 = edgeId - 1;
|
|
221
|
+
id2 = edgeId;
|
|
222
|
+
} else {
|
|
223
|
+
id1 = edgeId - 1;
|
|
224
|
+
id2 = edgeId + 1;
|
|
225
|
+
}
|
|
226
|
+
model.line.getPointsIds()[0] = model.pointsIds[id1];
|
|
227
|
+
model.line.getPointsIds()[1] = model.pointsIds[id2];
|
|
228
|
+
model.line.getPoints().setPoint(0, model.points.getPoint(id1));
|
|
229
|
+
model.line.getPoints().setPoint(1, model.points.getPoint(id2));
|
|
230
|
+
return model.line;
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Intersects a line with the triangle strip.
|
|
235
|
+
* @param {Vector3} p1 Start point of the line
|
|
236
|
+
* @param {Vector3} p2 End point of the line
|
|
237
|
+
* @param {number} tol Tolerance for intersection
|
|
238
|
+
* @param {Vector3} x Intersection point
|
|
239
|
+
* @param {Vector3} pcoords Parametric coordinates of the intersection
|
|
240
|
+
* @returns {Boolean} True if the line intersects the triangle strip
|
|
241
|
+
*/
|
|
242
|
+
publicAPI.intersectWithLine = (p1, p2, tol, x, pcoords) => {
|
|
243
|
+
const numTris = model.pointsIds.length - 2;
|
|
244
|
+
const points = model.triangle.getPoints();
|
|
245
|
+
points.setNumberOfPoints(3);
|
|
246
|
+
for (let i = 0; i < numTris; i++) {
|
|
247
|
+
const pt0 = [];
|
|
248
|
+
model.points.getPoint(model.pointsIds[i], pt0);
|
|
249
|
+
const pt1 = [];
|
|
250
|
+
model.points.getPoint(model.pointsIds[i + 1], pt1);
|
|
251
|
+
const pt2 = [];
|
|
252
|
+
model.points.getPoint(model.pointsIds[i + 2], pt2);
|
|
253
|
+
points.setData(Float32Array.from([...pt0, ...pt1, ...pt2]), 3);
|
|
254
|
+
const ret = model.triangle.intersectWithLine(p1, p2, tol, x, pcoords);
|
|
255
|
+
if (ret.intersect) {
|
|
256
|
+
return ret;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return false;
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
// Triangulate
|
|
263
|
+
/**
|
|
264
|
+
* Triangulate the triangle strip.
|
|
265
|
+
* @returns {Boolean} True if the triangulation is successful.
|
|
266
|
+
*/
|
|
267
|
+
publicAPI.triangulate = () => {
|
|
268
|
+
const numTris = model.points.getNumberOfPoints() - 2;
|
|
269
|
+
model.tris = new Array(3 * numTris);
|
|
270
|
+
const idx = [[0, 1, 2], [1, 0, 2]];
|
|
271
|
+
for (let subId = 0; subId < numTris; subId++) {
|
|
272
|
+
const order = subId % 2;
|
|
273
|
+
for (let i = 0; i < 3; i++) {
|
|
274
|
+
model.tris[subId * 3 + i] = subId + idx[order][i];
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return true;
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Get the point array of the triangle strip.
|
|
282
|
+
* @returns {Array} The point array.
|
|
283
|
+
*/
|
|
284
|
+
publicAPI.getPointArray = () => model.tris;
|
|
285
|
+
|
|
286
|
+
// Derivatives
|
|
287
|
+
/**
|
|
288
|
+
* Get the derivatives of the triangle strip.
|
|
289
|
+
* @param {Number} subId - The sub-id of the triangle.
|
|
290
|
+
* @param {Vector3} pcoords - The parametric coordinates.
|
|
291
|
+
* @param {Number[]} values - The values at the points.
|
|
292
|
+
* @param {Number} dim - The dimension.
|
|
293
|
+
* @param {Number[]} derivs - The derivatives.
|
|
294
|
+
*/
|
|
295
|
+
publicAPI.derivatives = (subId, pcoords, values, dim, derivs) => {
|
|
296
|
+
const pt0 = [];
|
|
297
|
+
model.points.getPoint(subId, pt0);
|
|
298
|
+
const pt1 = [];
|
|
299
|
+
model.points.getPoint(subId + 1, pt1);
|
|
300
|
+
const pt2 = [];
|
|
301
|
+
model.points.getPoint(subId + 2, pt2);
|
|
302
|
+
const points = model.triangle.getPoints();
|
|
303
|
+
points.setPoint(0, ...pt0);
|
|
304
|
+
points.setPoint(1, ...pt1);
|
|
305
|
+
points.setPoint(2, ...pt2);
|
|
306
|
+
model.triangle.derivatives(0, pcoords, values, dim, derivs);
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Get the parametric center of the triangle strip.
|
|
311
|
+
* @param {Vector3} pcoords - The parametric coordinates.
|
|
312
|
+
* @returns {Number} The parametric center.
|
|
313
|
+
*/
|
|
314
|
+
publicAPI.getParametricCenter = pcoords => {
|
|
315
|
+
pcoords[0] = 0.333333;
|
|
316
|
+
pcoords[1] = 0.333333;
|
|
317
|
+
pcoords[2] = 0.0;
|
|
318
|
+
return Math.floor((model.pointsIds.length - 2) / 2);
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Contour the triangle strip.
|
|
323
|
+
* @param {*} value
|
|
324
|
+
* @param {*} cellScalars
|
|
325
|
+
* @param {*} locator
|
|
326
|
+
* @param {*} verts
|
|
327
|
+
* @param {*} lines
|
|
328
|
+
* @param {*} polys
|
|
329
|
+
* @param {*} inPd
|
|
330
|
+
* @param {*} outPd
|
|
331
|
+
* @param {*} inCd
|
|
332
|
+
* @param {*} cellId
|
|
333
|
+
* @param {*} outCd
|
|
334
|
+
* @returns
|
|
335
|
+
*/
|
|
336
|
+
publicAPI.contour = (value, cellScalars, locator, verts, lines, polys, inPd, outPd, inCd, cellId, outCd) => notImplemented('contour')();
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Clip the triangle strip.
|
|
340
|
+
* @param {*} value Clipping value
|
|
341
|
+
* @param {*} cellScalars Cell scalars
|
|
342
|
+
* @param {*} locator Locator
|
|
343
|
+
* @param {*} tris Triangle indices
|
|
344
|
+
* @param {*} inPd Input point data
|
|
345
|
+
* @param {*} outPd Output point data
|
|
346
|
+
* @param {*} inCd
|
|
347
|
+
* @param {*} cellId
|
|
348
|
+
* @param {*} outCd
|
|
349
|
+
* @param {*} insideOut
|
|
350
|
+
* @returns
|
|
351
|
+
*/
|
|
352
|
+
publicAPI.clip = (value, cellScalars, locator, tris, inPd, outPd, inCd, cellId, outCd, insideOut) => notImplemented('clip')();
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// ----------------------------------------------------------------------------
|
|
356
|
+
// Object factory
|
|
357
|
+
// ----------------------------------------------------------------------------
|
|
358
|
+
|
|
359
|
+
const DEFAULT_VALUES = {
|
|
360
|
+
line: null,
|
|
361
|
+
triangle: null,
|
|
362
|
+
tris: null
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
// ----------------------------------------------------------------------------
|
|
366
|
+
|
|
367
|
+
function extend(publicAPI, model) {
|
|
368
|
+
let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
369
|
+
Object.assign(model, DEFAULT_VALUES, initialValues);
|
|
370
|
+
|
|
371
|
+
// Inheritance
|
|
372
|
+
vtkCell.extend(publicAPI, model, initialValues);
|
|
373
|
+
if (!model.line) {
|
|
374
|
+
model.line = vtkLine.newInstance();
|
|
375
|
+
}
|
|
376
|
+
if (!model.triangle) {
|
|
377
|
+
model.triangle = vtkTriangle.newInstance();
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// Build VTK API
|
|
381
|
+
vtkTriangleStrip(publicAPI, model);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// ----------------------------------------------------------------------------
|
|
385
|
+
|
|
386
|
+
const newInstance = macro.newInstance(extend, 'vtkTriangleStrip');
|
|
387
|
+
|
|
388
|
+
// ----------------------------------------------------------------------------
|
|
389
|
+
|
|
390
|
+
var vtkTriangleStrip$1 = {
|
|
391
|
+
newInstance,
|
|
392
|
+
extend,
|
|
393
|
+
...STATIC
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
export { STATIC, vtkTriangleStrip$1 as default, extend, newInstance };
|
package/Common/DataModel.js
CHANGED
|
@@ -18,6 +18,7 @@ import vtkSelectionNode from './DataModel/SelectionNode.js';
|
|
|
18
18
|
import vtkSphere from './DataModel/Sphere.js';
|
|
19
19
|
import vtkStructuredData from './DataModel/StructuredData.js';
|
|
20
20
|
import vtkTriangle from './DataModel/Triangle.js';
|
|
21
|
+
import vtkTriangleStrip from './DataModel/TriangleStrip.js';
|
|
21
22
|
|
|
22
23
|
var DataModel = {
|
|
23
24
|
vtkBoundingBox,
|
|
@@ -39,7 +40,8 @@ var DataModel = {
|
|
|
39
40
|
vtkSelectionNode,
|
|
40
41
|
vtkSphere,
|
|
41
42
|
vtkStructuredData,
|
|
42
|
-
vtkTriangle
|
|
43
|
+
vtkTriangle,
|
|
44
|
+
vtkTriangleStrip
|
|
43
45
|
};
|
|
44
46
|
|
|
45
47
|
export { DataModel as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mat4, mat3 } from 'gl-matrix';
|
|
2
2
|
import Constants from './LandmarkTransform/Constants.js';
|
|
3
3
|
import { m as macro } from '../../macros2.js';
|
|
4
|
-
import {
|
|
4
|
+
import { q as jacobiN, t as perpendiculars } from '../Core/Math/index.js';
|
|
5
5
|
|
|
6
6
|
const {
|
|
7
7
|
Mode
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { mat4, vec3 } from 'gl-matrix';
|
|
1
|
+
import { mat3, mat4, vec3 } from 'gl-matrix';
|
|
2
2
|
import { vtkObject } from './../../interfaces';
|
|
3
3
|
import { TypedArray } from './../../types';
|
|
4
|
+
import vtkDataArray from './../Core/DataArray';
|
|
5
|
+
import vtkPoints from './../Core/Points';
|
|
4
6
|
|
|
5
7
|
export interface ITransformInitialValues {
|
|
6
8
|
preMultiplyFlag?: boolean;
|
|
@@ -144,6 +146,115 @@ export interface vtkTransform extends vtkObject {
|
|
|
144
146
|
* @returns A new transform with an inversed internal matrix. Also copy the premultiply flag @see getPreMultiplyFlag.
|
|
145
147
|
*/
|
|
146
148
|
getInverse(): vtkTransform;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Create a translation matrix and concatenate it with the current
|
|
152
|
+
* transformation according to preMultiply or postMultiply semantics.
|
|
153
|
+
* @param {Number} x X component of the translation
|
|
154
|
+
* @param {Number} y Y component of the translation
|
|
155
|
+
* @param {Number} z Z component of the translation
|
|
156
|
+
*/
|
|
157
|
+
translate(x: number, y: number, z: number): void;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Create a rotation matrix and concatenate it with the current transformation
|
|
161
|
+
* according to preMultiply or postMultiply semantics.
|
|
162
|
+
* The angle is expressed in degrees.
|
|
163
|
+
* @param {Number} angle Angle in degrees
|
|
164
|
+
* @param {Number} x X component of the rotation axis
|
|
165
|
+
* @param {Number} y Y component of the rotation axis
|
|
166
|
+
* @param {Number} z Z component of the rotation axis
|
|
167
|
+
*/
|
|
168
|
+
rotateWXYZ(angle: number, x: number, y: number, z: number): void;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Create a rotation matrix and concatenate it with the current transformation
|
|
172
|
+
* according to preMultiply or postMultiply semantics.
|
|
173
|
+
* The angle is expressed in degrees.
|
|
174
|
+
* @param {Number} angle Angle in degrees
|
|
175
|
+
*/
|
|
176
|
+
rotateX(angle: number): void;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Create a rotation matrix about the X, Y, or Z axis and concatenate it with
|
|
180
|
+
* the current transformation according to preMultiply or postMultiply
|
|
181
|
+
* semantics.
|
|
182
|
+
* @param {Number} angle Angle in degrees
|
|
183
|
+
*/
|
|
184
|
+
rotateY(angle: number): void;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Create a rotation matrix about the X, Y, or Z axis and concatenate it with
|
|
188
|
+
* the current transformation according to preMultiply or postMultiply
|
|
189
|
+
* semantics.
|
|
190
|
+
* @param {Number} angle Angle in degrees
|
|
191
|
+
*/
|
|
192
|
+
rotateZ(angle: number): void;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Create a scale matrix (i.e. set the diagonal elements to x, y, z) and
|
|
196
|
+
* concatenate it with the current transformation according to preMultiply or
|
|
197
|
+
* postMultiply semantics.
|
|
198
|
+
* @param {Number} x Diagonal element for X axis
|
|
199
|
+
* @param {Number} y Diagonal element for Y axis
|
|
200
|
+
* @param {Number} z Diagonal element for Z axis
|
|
201
|
+
*/
|
|
202
|
+
scale(x: number, y: number, z: number): void;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Apply the transformation to a normal.
|
|
206
|
+
* @param {vec3} inNormal The normal vector to transform
|
|
207
|
+
* @param {vec3} outNormal The output vector
|
|
208
|
+
* @returns {vec3} The transformed normal vector
|
|
209
|
+
*/
|
|
210
|
+
transformNormal(inNormal: vec3, outNormal?: vec3): vec3;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Apply the transformation to a series of normals, and append the results to
|
|
214
|
+
* outNormals.
|
|
215
|
+
* @param {vtkDataArray} inNormals The normal vectors to transform
|
|
216
|
+
* @param {vtkDataArray} outNormals The output array
|
|
217
|
+
*/
|
|
218
|
+
transformNormals(inNormals: vtkDataArray, outNormals: vtkDataArray): void;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Transform points, normals, and vectors simultaneously.
|
|
222
|
+
* @param {vtkPoints} inPoints Input points
|
|
223
|
+
* @param {vtkPoints} outPoints Output points
|
|
224
|
+
* @param {vtkDataArray} inNormals Input normals
|
|
225
|
+
* @param {vtkDataArray} outNormals Output normals
|
|
226
|
+
* @param {vtkDataArray} inVectors Input vectors
|
|
227
|
+
* @param {vtkDataArray} outVectors Output vectors
|
|
228
|
+
* @param {Array<vtkDataArray>} inVectorsArr Optional input vectors arrays
|
|
229
|
+
* @param {Array<vtkDataArray>} outVectorsArr Optional output vectors arrays
|
|
230
|
+
*/
|
|
231
|
+
transformPointsNormalsVectors(
|
|
232
|
+
inPoints: vtkPoints,
|
|
233
|
+
outPoints: vtkPoints,
|
|
234
|
+
inNormals: vtkDataArray,
|
|
235
|
+
outNormals: vtkDataArray,
|
|
236
|
+
inVectors: vtkDataArray,
|
|
237
|
+
outVectors: vtkDataArray,
|
|
238
|
+
inVectorsArr?: Array<vtkDataArray>,
|
|
239
|
+
outVectorsArr?: Array<vtkDataArray>
|
|
240
|
+
): void;
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Apply the transformation to a vector.
|
|
244
|
+
* @param {vec3} inVector The vector to transform
|
|
245
|
+
* @param {vec3} outVector The output vector
|
|
246
|
+
* @param {mat3} [matrix=null] if null (default), the Transform matrix is being used.
|
|
247
|
+
* @returns {vec3} The transformed vector
|
|
248
|
+
*/
|
|
249
|
+
transformVector(inVector: vec3, outVector?: vec3, matrix?: mat3): vec3;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Apply the transformation to a series of vectors, and append the results to
|
|
253
|
+
* outVectors.
|
|
254
|
+
* @param {vtkDataArray} inVectors The vectors to transform
|
|
255
|
+
* @param {vtkDataArray} outVectors The output array
|
|
256
|
+
*/
|
|
257
|
+
transformVectors(inVectors: vtkDataArray, outVectors: vtkDataArray): void;
|
|
147
258
|
}
|
|
148
259
|
|
|
149
260
|
/**
|