The Peirce quincuncial projection is pretty neat. It actually tessellates the whole plane:

Your job is to generate this map projection.

To simplify things, you will only need to generate the northern hemisphere.

Also, you will be given the stereographic projection of the northern hemisphere as input:

(based on https://commons.wikimedia.org/wiki/File:Stereographic_Projection_Polar_Extreme.jpg).

Which means all that is left for you to do is to map this disk onto a square in an angle-preserving manner (as described here). (Note: You may assume that the disk touches all four sides of the input image.)

This is code-golf, so the shortest code wins!

  • 1
    \$\begingroup\$ I'm unsure what we're supposed to output. Just one tile of the top image? \$\endgroup\$
    – xnor
    Mar 13, 2018 at 21:46
  • \$\begingroup\$ @xnor That's correct. \$\endgroup\$
    – PyRulez
    Mar 13, 2018 at 22:11
  • \$\begingroup\$ So this is graphical output? Does the tile need to tilted like a diamond? Can the circle be rotated however before being mapped to a square? Any resolution requirements? Can the output include parts of the red circle outline? I think an example output would be helpful, especially because the top image seems to use a different map image. \$\endgroup\$
    – xnor
    Mar 14, 2018 at 0:06
  • \$\begingroup\$ @xnor You can rotate things however you wish, and there are no resolution requirements. Also, you have to include the red circle since its part of the input image. \$\endgroup\$
    – PyRulez
    Mar 14, 2018 at 0:26


Browse other questions tagged or ask your own question.