Advertisement
Matthen

Rolling a Globe

Nov 25th, 2011
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. map = Graphics[{RGBColor[0, 0.8, 0.2],
  2. ({ColorData["ArmyColors"][Random[]],
  3. CountryData[#, "SchematicPolygon"]} &) /@ CountryData[],
  4. Darker@Red,
  5. Table[Line[{{-180, i}, {180, i}}], {i, -90, 90, 10}],
  6. Table[Line[{{i, -90}, {i, 90}}], {i, -180, 180, 20}]
  7.  
  8. }, Background -> RGBColor[0.2, 0.5, 0.8], ImageSize -> 500,
  9. PlotRange -> {{-180, 180}, {-70, 90}}];
  10. rollmap =
  11. ImageTransformation[
  12. map, {ArcTan[-#[[2]], #[[1]]], Mod[-Norm[#], Pi]} &,
  13. DataRange -> {{-Pi, Pi}, {0, Pi}},
  14. PlotRange -> 2 Pi {{-1, 1}, {-1, 1}}];
  15. globe = ParametricPlot3D[{Cos[ \[Phi]] Sin[\[Theta]],
  16. Sin[\[Phi]] Sin[\[Theta]], Cos[\[Theta]]}/(2 Pi), {\[Phi], 0,
  17. 2 \[Pi]}, {\[Theta], 0, \[Pi]}, Mesh -> None,
  18. PlotStyle -> Texture[map],
  19. TextureCoordinateFunction -> ({#4 + 3 Pi/2, #3 } &),
  20. Lighting -> "Neutral", Axes -> False, RotationAction -> "Clip"];
  21. Show[Graphics3D[{Texture[rollmap],
  22. Polygon[{{-1, -1, 1/(2 Pi)}, {1, -1, 1/(2 Pi)}, {1, 1,
  23. 1/(2 Pi)}, {-1, 1, 1/(2 Pi)}
  24. }, VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0,
  25. 1}}]}, Lighting -> "Neutral", Boxed -> False,
  26. ViewPoint -> {-10, -10, -5},
  27. PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}/(2 Pi)}, ImageSize -> 1000],
  28. globe]
  29.  
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement