# Stereographic Projection

Say I want to represent points of the complex plane in the sphere $\Bbb S^2$ using stereographic projection. That is, the Riemann sphere: Specifically, it would be nice to be able to:

1. Given the coordinates $(x,y)$ of a point of the plane, see the point and its spherical image, and optionally, the line through the north pole and $(x,y,0)$.
2. Given a circle in the plane, (that is, its center $(x,y)$ and its radius $r\gt 0$), see the circle and its spherical image.
3. Optionally: it would be nice as well but is not necessary, being able to project in the sphere other kinds of sets, say polygons, sets of points, maybe straight lines, etc.

How can we do this? Is this already possible in Mathematica, I mean as built in functions?

This is an idea for your use: • This came to me by trying to solve this problem. See this to see where I'm having troubles. I think most of my confusion will disappear by seeing some drawings.
– leo
Apr 22, 2013 at 18:04
• btw you might find something useful for you problem in Mathematica. Apr 22, 2013 at 18:14
• also useful: Riemann sphere Apr 22, 2013 at 18:55
• A search on "stereographic" produces many solutions (including in more dimensions). Apr 22, 2013 at 19:45
• @J.M. Modesty :-) Apr 23, 2013 at 14:28

I think you can do like this:

f[{x_, y_}] := {(2 x)/(1 + x^2 + y^2), (2 y)/(
1 + x^2 + y^2), (-1 + x^2 + y^2)/(1 + x^2 + y^2)}


for points:

Manipulate[
Graphics3D[{{Black, PointSize[Large], Point[{0, 0, 1}]}, {Black,
PointSize[Large], Point[Append[pt, 0]]}, {Pink, PointSize[Large],
Point[f[pt]]}, {Opacity[0.2], Sphere[]}, {Opacity[0.2],
Cuboid[{-2.1, -2.1, -.01}, {2.1, 2.1, 0}]}, {Line[{{0, 0, 1},
f[pt], Append[pt, 0]}]}},
PlotRange -> 2], {pt, {-2, -2}, {2, 2}}] for a general line:

p = Plot[Sin[2 x], {x, 0, π}];
pts = Cases[p, Line[x__] :> x, ∞][];
Graphics3D[{{Pink, Line[f /@ pts]}, {Opacity[0.2], Sphere[]}, {Black,
Line[pts /. {x_, y_} -> {x, y, 0}]}}] for circle:

Manipulate[
Block[{cc, pts},
cc = ParametricPlot[
pt0 + {r0 Cos[θ], r0 Sin[θ]}, {θ, 0,
2 π}];
pts = Cases[cc, Line[x__] :> x, ∞][];
Graphics3D[{{Pink, Line[f /@ pts]}, {Opacity[0.2],
Sphere[]}, {Black, Line[pts /. {x_, y_} -> {x, y, 0}]}},
PlotRange -> 2.5]], {{pt0, {0, 0}}, {-2, -2}, {2, 2}}, {{r0, 0.2},
0, 1}] • I get a red box output stating that "coordinates\$cellCOntext should be triple of numbers or scaled form" in version 12.3. How would I rectify this? Nov 12, 2021 at 8:15

Just to extend the answer of @user0501 (a little) using the definition of f:

pp[x_] :=
ParametricPlot3D[ f[{x + u, y}], {u, 0, 0.1}, {y, -1, 1},
Mesh -> None]
ppy[y_] :=
ParametricPlot3D[ f[{x, y + u}], {u, 0, 0.1}, {x, -1, 1},
Mesh -> None]
Show[Table[pp[j], {j, -1, 1, 0.25}]~Join~
Table[ppy[j], {j, -1, 1, 0.25}],
PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}}, Background -> Black,
Boxed -> False] 