Stereographic Projection
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, ∞][[1]];
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, ∞][[1]];
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}]
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]