Message Boards Message Boards

[GIF] Fall In (Stereographic projection of dots on the sphere)


Stereographic projection of dots on the sphere

Fall In

This is fairly straightforward: put 32 equally-spaced dots of (spherical) radius 0.03 on 20 equally-spaced circles of latitude on the unit sphere. Move the circles steadily down (with constant speed in the $z$-direction, not constant speed on the sphere), and project the whole image to the plane, adding in a color gradient. The key function is ProjectedSphericalCircle[], which converts a spherical disk to a stereographically-projected planar disk; the code for that function is here.

One slight nuisance is that Disk[] doesn't seem to rasterize very well at low resolutions: the positioning of the disk in the resulting image is not very precise. I presume this is due to the discreteness of the pixel grid, and that the rasterization function tries to center the disk on a pixel or something of that nature, but the result is that outputting this to a GIF at the final resolution produces a bunch of dots that dance around quite a bit, as in this version:

Stereographic projection with dancing dots, presumably due to discretization effects

To get smooth movement I ended up having to output at 2160x2160 and then resize in ImageMagick to the final 540x540 resolution.

Anyway, here's the code:

DynamicModule[{k = 32, l = 10, p,
  cols = RGBColor /@ {"#EF476F", "#FFD166", "#06D6A0", "#118AB2", "#0C1C2C"}},
  p = Flatten[Table[
     Normalize[{Sqrt[1 - #^2] Cos[θ], Sqrt[1 - #^2] Sin[θ], #} &[z - t]],
     {z, -1. + 1/l, 1, 1/l}, {θ, π/k, 2 π, 2 π/k}], 1];
   {{Blend[cols[[;; -2]], 1/2 #[[3]] + 1/2], ProjectedSphericalCircle[#, .03]} & /@ p},
   PlotRange -> 2, ImageSize -> 540, Background -> cols[[-1]]],
  {t, .001, 1/l}]
POSTED BY: Clayton Shonkwiler
2 months ago

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: Moderation Team
1 month ago

Group Abstract Group Abstract