function drawIsoLines([xMin, xMax], [yMin, yMax]) {
const sizeX = xMax - xMin;
const sizeY = yMax - yMin;
const offset = [xMin, yMin];
const intervals = linspace(spacing);
const gridSize = gridsize;
const lines = [];
let data = [];
Random.setSeed(seed);
for (let y = 0; y < gridSize; y++) {
data[y] = [];
for (let x = 0; x < gridSize; x++) {
const scale = gridSize;
const noiseValue = worleyNoiseField[y][x];
data[y].push(noiseValue);
}
}
intervals.forEach((_, idx) => {
if (idx > 0) {
const lowerBand = intervals[idx - 1];
const upperBand = intervals[idx];
isoBands(data, lowerBand, upperBand - lowerBand, {
successCallback(bands) {
bands.forEach(band => {
const scaledBand = band.map(([x, y]) => [
offset[0] + mapRange(x, 0, gridSize - 1, 0, sizeX),
offset[1] + mapRange(y, 0, gridSize - 1, 0, sizeY)
]);
lines.push(scaledBand);
});
}
});
}
});
return lines;
}