Skip to content

Commit 4ac90eb

Browse files
committed
may help handle parametric x y z coordinates
1 parent 1da04df commit 4ac90eb

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/traces/isosurface/convert.js

+13-8
Original file line numberDiff line numberDiff line change
@@ -388,18 +388,23 @@ function generateIsosurfaceMesh(data) {
388388
Ys[0],
389389
Zs[0]
390390
];
391-
var ends = [
392-
Xs[Xs.length - 1],
393-
Ys[Ys.length - 1],
394-
Zs[Zs.length - 1]
395-
];
391+
392+
// may possibly help handle parametric coordinates
393+
var sumOnAxis = [0, 0, 0];
394+
for(i = 1; i < Xs.length; i++) {
395+
sumOnAxis[0] += Xs[i] - Xs[i - 1];
396+
}
397+
for(j = 1; j < Ys.length; j++) {
398+
sumOnAxis[1] += Ys[j] - Ys[j - 1];
399+
}
400+
for(k = 1; k < Zs.length; k++) {
401+
sumOnAxis[2] += Zs[k] - Zs[k - 1];
402+
}
396403

397404
// map pixel coordinates (0..n) to (real) world coordinates
398405
for(axis = 0; axis < 3; axis++) {
399-
var start = starts[axis];
400-
var end = ends[axis];
401406
for(q = 0; q < len; q++) {
402-
positions[q][axis] = start + (end - start) * positions[q][axis] / (dims[axis] - 1);
407+
positions[q][axis] = starts[axis] + sumOnAxis[axis] * positions[q][axis] / (dims[axis] - 1);
403408
}
404409
}
405410

0 commit comments

Comments
 (0)