Works "better" now but it's finding 17 wacky disjoint sets instead of 7
This commit is contained in:
parent
303a2971fe
commit
1e59b55f5e
@ -112,7 +112,7 @@ function overlap(c1, c2) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return overlap;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -146,21 +146,20 @@ export function gather_5cells() {
|
||||
cells.push(cell);
|
||||
}
|
||||
}
|
||||
//console.log(`From ${n.id}`);
|
||||
//console.log(cells);
|
||||
for( const cell of cells ) {
|
||||
let binned = false;
|
||||
for( const bin of bins ) {
|
||||
const overlaps = bin.filter((b) => overlap(b, cell));
|
||||
console.log(bin);
|
||||
console.log(cell);
|
||||
console.log(overlaps);
|
||||
if( overlaps.length === 0 ) {
|
||||
if( overlaps.length === 0 ) {
|
||||
bin.push(cell);
|
||||
binned = true;
|
||||
console.log("binned");
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( !binned ) {
|
||||
console.log(`new bin for ${JSON.stringify(cell)}`);
|
||||
bins.push([ cell ]);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user