I want to apply non-geometric transformations to polygons etc, the goal is to have a Manipulate
objects that behaves like that famous möbius transform video.
Since I was unable to apply non-geometric transformation to a polygon I went ahead and created a bunch of points in the plane and did appropriate transforms to them
(* plane region *)
region = {-1, 1};
d = 0.07;
(* Some points in plane *)
pts = Flatten[Table[{xi, yi, 0},
{xi, First@region, Last@region, d},
{yi, First@region, Last@region, d}]
, 1];
col = ColorData["Rainbow"] /@ Rescale[pts[[All, 1]], region];
(** Projections from plane to sphere on line going through north pole \
of sphere centered at {0, 0, 1} **)
(* Plane to sphere *)
f[vec_] := With[{t = 4/(4 + vec[[1]]^2 + vec[[2]]^2)}, vec*t + (1 - t) {0, 0, 2}]
(* Sphere to plane *)
g[vec_] := With[{t = -(2/(-2 + Last@vec))}, vec*t + (1 - t) {0, 0, 2}]
rt = RotationTransform[2.1, {0, 1, 0}, {0, 0, 1}];
Graphics3D[{
{Black, Opacity[0.3], Sphere[{0, 0, 1}]},
Point[(rt@f@# &) /@ pts, VertexColors -> col],
Point[((g@rt@f@# &) /@ pts), VertexColors -> col]
},
PlotRange -> {{-10, 10}, {-10, 10}, {0, 2}}]
I wish that I could instead do something like:
Graphics3D[{
{Black, Opacity[0.3], Sphere[{0, 0, 1}]},
SomeTransformation[Polygon[{ {-1, -1, 0}, {-1, 1, 0}, {1, 1, 0}, {1, -1, 0}}], rt@f@#&],
SomeTransformation[Polygon[{ {-1, -1, 0}, {-1, 1, 0}, {1, 1, 0}, {1, -1, 0}}], g@rt@f@#&]
]
And end up with a smooth output, not just a few points here and there.
Is there already a function like this that I have missed?
If not are there other ways to arrive at the same result?
How about for more advanced transformations?
Polygon
outlines. $\endgroup$