Last active
August 21, 2018 01:23
-
-
Save Lucent/2663406 to your computer and use it in GitHub Desktop.
Create lists of nonoverlapping plane datablocks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function move_overlaps_higher(overlaps) { | |
cycle_list[0] = overlaps; | |
var another_row_needed = true; | |
for (var cyclerow = 0; another_row_needed; cyclerow++) { | |
another_row_needed = false; | |
var this_row = cycle_list[cyclerow]; | |
for (var ident = 0; ident < this_row.length; ident++) { | |
for (var x = ident - 1; x >= 0; x--) { | |
if (x < 0) continue; | |
if (in_array(this_row[ident], covers_pairs[this_row[x]]) || in_array(this_row[ident], covered_pairs[this_row[x]])) { | |
if (cycle_list.length === cyclerow + 1) cycle_list[cyclerow + 1] = []; | |
cycle_list[cyclerow + 1].push(this_row[ident]); | |
this_row.splice(ident, 1); | |
ident--; | |
another_row_needed = true; | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment