First implementation of surface splitting.

It's rather slow at the moment, but it at least gives correct results!