Stereographic Projection

By Xah Lee. Date: . Last updated: .
Stereographic projection
stereographic projection, associating points on the plane and points on the sphere
Clear[xd, xlen, projectF, grid2d, grid3d, xball  ];

xd = 0.2;
xlen = 2;

projectF = ( With[{xx = 1 + #.#}, {#[[1]]/xx, #[[2]]/xx, 1 - 1/xx}] &);

grid2d = Table[{Hue[0], Line[{{x, y}, {x, y + xd}}], GrayLevel[ 0.5 ],
    Line[{{x, y}, {x + xd, y}}]}, {x, -xlen, xlen, xd}, {y, -xlen,
     xlen, xd}];

Graphics[grid2d]

grid3d = grid2d /. Line[xpts_] :> Line[(({#[[1]],#[[2]],0}) &) /@ xpts];
Graphics3D[grid3d]

xball = grid2d /. Line[xpts_] :> Line[projectF /@ xpts];

Graphics3D[xball]

Graphics3D[{grid3d, xball}]

more examples:

star arrow network star arrow network rs
hexagram snowflake hexagram snowflake rs
random hex tiling random hex tiling projection
random hex tiling random hex tiling projection

Notes

The images on this page is generated by the following Mathematica packages: