It can probably be handled by a scanline sort of ordeal (I'm thinking polygon filling). But uh, how exactly do you want the output? You say "half-ish squares," but what does that really mean? Are you looking to modify the data in the OG square array?
I'm trying to recreate the break-off mechanics from games like Space Engineers and KSP. If two halves of an object occupy a 2d grid and the parts holding the pieces together are removed, the pieces are put into their own grid arrays and become their own entities
in what form is the input line? if you can get it in slope-intercept form and the split is always along a line, deciding which elements go in which bin is easy.
The line represents the objects removed from the grid, not necessarily a literal line. If you have a grid arranged like this:
00000000
01100110
01111110
01100110
01111110
01100110
00000000
Where 1s are existing objects and 0s represent an imaginary part of the array which doesn't exist (deleted elements, for instance)
Then if you remove the "middle" parts:
00000000
01100110
01100110
01100110
01100110
01100110
00000000
It creates two groups of things. I can understand how they could connect to each other using an array of adjacent IDs per object, but I don't know how to separate them into two or more new arrays using this information:
0000 0000
0110 0110
0110 0110
0110 0110
0110 0110
0110 0110
0000 0000
another example:
00000000
01100110
01100110
01100110
01111110
01100110
00000000
00000000
01100110
01100110
01100000
01100110
01100110
00000000
0000 0000
0110 0110
0110 0110
0110 0000
0110
0110
0000
0000
0110
0110
0000