wwei47 wrote: ↑
June 15th, 2021, 9:46 pm
This question is a lot harder than it looks. Given a single true object on a 100-by-50 torus (I've already written the object separation algorithms), how would I unwrap it onto an infinite plane? This: ... Would unwrap to this. ...
This isn't really a well-defined function. E.g. if there's a bridge connecting any of the stripes, this may not be possible, if the connections form cycles that wrap entirely around the torus. One can find a solution that works for the limited number of still-lifes that don't include loops like this.
One way to do it is similar to how one might do object separation - i.e. mark one cell as part of an object, and then look at any unmarked cells adjacent to marked ones as part of the same object.
In the same way, mark one arbitrary living cell as being in the corresponding place in the infinite plane (i.e. by tatting it as having a known offset, based on how often one's viewpoint wraps around the torus, and being ininitially 0 for the first chosen tell). Then, expand from marked cells to unmarked cells, adjusting the offset every time you wrap around the torus boundaries. If you ever want to mark a cell with a different offset than it is already marked as, you have found an object that cannot be mapped on to the plane. Once all cells have been mapped without encountering such a problem, you have successfully unwrapped your still life.