Skip to content

Commit d4447b2

Browse files
Update src/visualization/vtkSolutionScript.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 46991c2 commit d4447b2

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/visualization/vtkSolutionScript.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -430,10 +430,18 @@ function buildInterpolatedVtkData(model, result, meshData) {
430430
elementOrder: model.meshConfig.elementOrder,
431431
});
432432

433-
const minX = Math.min(...nodesXCoordinates);
434-
const maxX = Math.max(...nodesXCoordinates);
435-
const minY = Math.min(...nodesYCoordinates);
436-
const maxY = Math.max(...nodesYCoordinates);
433+
let minX = nodesXCoordinates[0];
434+
let maxX = nodesXCoordinates[0];
435+
let minY = nodesYCoordinates[0];
436+
let maxY = nodesYCoordinates[0];
437+
for (let i = 1; i < nodesXCoordinates.length; i++) {
438+
const x = nodesXCoordinates[i];
439+
const y = nodesYCoordinates[i];
440+
if (x < minX) minX = x;
441+
if (x > maxX) maxX = x;
442+
if (y < minY) minY = y;
443+
if (y > maxY) maxY = y;
444+
}
437445

438446
const lengthX = maxX - minX;
439447
const lengthY = maxY - minY;

0 commit comments

Comments
 (0)