Message Boards Message Boards

[GIF] Who's the Boss? (Stereographic projection of a pyramid)

Stereographic projection of a pyramid

Who's the Boss?

Here, I'm just taking the square pyramid, projecting it onto the unit sphere, rotating around the $y$-axis, then stereographically projecting to the plane. I like the resulting dynamic, even if it's a bit simple.

In order for this to work, I need to parametrize the projected edges of a polyhedron, like so:

sphericalPolyhedron[polyhedron_, t_] := Module[{edgeindices, edges},
   edgeindices = PolyhedronData[polyhedron, "Edges"][[2, 1]];
   edges = PolyhedronData[polyhedron, "VertexCoordinates"][[#]] & /@ edgeindices;
   Normalize[(1 - t) #[[1]] + t #[[2]]] & /@ edges
   ];

Now, we need just a few other functions, namely stereographic projection and the smoother step function:

Stereo[p_] := p[[;; -2]]/(1 - p[[-1]]);
smootherstep[x_] := 6 x^5 - 15 x^4 + 10 x^3;

Here's the rest of the code:

DynamicModule[{m1, m2, e, ?, 
  cols = RGBColor /@ {"#50E3C2", "#FF7A5A", "#FCF4D9", "#432160"}},
 Manipulate[
  ? = ? + 2 ? smootherstep[s];
  m1 = RotationMatrix[-?, {0, 1, 0}];
  m2 = RotationMatrix[?/4, {0, 0, 1}];
  e = sphericalPolyhedron[{"Pyramid", 4}, t];
  ParametricPlot[Evaluate[Stereo[m1.m2.#] & /@ e], {t, 0, 1},
   PlotStyle -> Table[Directive[Thickness[.01], cols[[If[i >= 5, 3, Ceiling[i/2]]]]], {i, 1, 8}], 
   PlotRange -> 4, Axes -> False, ImageSize -> {540, 540}, 
   Background -> cols[[-1]]],
  {s, 0, 1}]
 ]

enter image description here - Congratulations! This post is now a Staff Pick as distinguished by a badge on your profile! Thank you, keep it coming!

POSTED BY: EDITORIAL BOARD
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract