()
| 1280 | } |
| 1281 | |
| 1282 | split() { |
| 1283 | if (this.pixels.length < 2) return null; |
| 1284 | |
| 1285 | const channel = this.splitChannel; |
| 1286 | this.pixels.sort((a, b) => a[channel] - b[channel]); |
| 1287 | |
| 1288 | const mid = Math.floor(this.pixels.length / 2); |
| 1289 | const box1 = new ColorBox(this.pixels.slice(0, mid), this.level + 1); |
| 1290 | const box2 = new ColorBox(this.pixels.slice(mid), this.level + 1); |
| 1291 | |
| 1292 | return [box1, box2]; |
| 1293 | } |
| 1294 | } |
| 1295 | |
| 1296 | // 初始化 |
no outgoing calls
no test coverage detected