Message Boards Message Boards

GROUPS:

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

Posted 1 year ago
1779 Views
|
1 Reply
|
6 Total Likes
|

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!

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