Message Boards Message Boards

[GIF] Grid (Transformation of the square grid)

Transformation of the square grid

Grid

Unlike Part of the Journey, Play, and Limits, this is not a conformal transformation of a regular grid on the plane. Instead, I've taken the square grid, inverse steregraphically projected it to the sphere, then orthogonally projected back to the plane, producing a collection of curves contained in the unit disk. This is not conformal since orthogonal projection does not preserve angles.

In the animation, I'm translating the entire grid by $-t (1,2)$ as $t$ varies from 0 to 1, which is a symmetry of the square grid, and applying the inverse-stereographic-project-then-orthogonally-project transformation.

There are a couple of quirks in the code. First, the Disk[] is there because I didn't extend the grid out far enough to actually fill in the center (which would have been computationally expensive); instead I just placed a small disk in the center to cover the hole in the middle. Second, the funny business on x in the Table[] is because I'm using progressively less precision for the grid lines which cluster in the center in order to cut down on computational complexity that doesn't actually contribute anything visible.

Anyway, here is the code:

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

With[{d = 30, cols = RGBColor /@ {"#FF5151", "#000249"}},
 Manipulate[
  Graphics[
   {cols[[1]], Disk[{0, 0}, .07], Thickness[.003], 
    Line /@ # & /@ (Transpose /@ Table[InverseStereo[# - t {1, 2}][[;; 2]] & /@ {{n, x}, {x, n}},
        {n, -d - 0.5, d + 0.5, 1}, 
         {x, Join[Range[-d, -20], Table[-20 + i Abs[n]/40, {i, 1, 1600/Abs[n]}], Range[20, d]]}])},
   Background -> cols[[-1]], ImageSize -> 540, PlotRange -> 1.1],
  {t, 0., 1}]
 ]
3 Replies

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

Very nice, always mind-bending visualizations!

I like the line:

Line /@ # & /@ 

Which is like:

Map[Line,#,{2}]& @

but it can be simplified to:

Line /@

because Line can handle multiple linesÂ…

POSTED BY: Sander Huisman

Yeah, true enough. I always forget that Line can produce multiple lines.

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