Cube projection algorithm