| 6403 | smooth = smoothLinear; |
| 6404 | |
| 6405 | function contours(values) { |
| 6406 | var tz = threshold(values); |
| 6407 | |
| 6408 | // Convert number of thresholds into uniform thresholds. |
| 6409 | if (!Array.isArray(tz)) { |
| 6410 | const e = extent$1(values, finite); |
| 6411 | tz = ticks(...nice$1(e[0], e[1], tz), tz); |
| 6412 | while (tz[tz.length - 1] >= e[1]) tz.pop(); |
| 6413 | while (tz[1] < e[0]) tz.shift(); |
| 6414 | } else { |
| 6415 | tz = tz.slice().sort(ascending$1); |
| 6416 | } |
| 6417 | |
| 6418 | return tz.map(value => contour(values, value)); |
| 6419 | } |
| 6420 | |
| 6421 | // Accumulate, smooth contour rings, assign holes to exterior rings. |
| 6422 | // Based on https://github.com/mbostock/shapefile/blob/v0.6.2/shp/polygon.js |