Mapping WorldPlot onto a sphere
- To: mathgroup at smc.vnet.net
- Subject: [mg37982] Mapping WorldPlot onto a sphere
- From: John Leary <leary at paradise.net.nz>
- Date: Sat, 23 Nov 2002 19:15:13 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Greetings In a recent posting, someone (sorry, I forget who) bemoaned the fact that it isn't possible to map WorldPlot onto a sphere. In fact MathSource has programs that make it possible: Mathview3D`OpenGLViewer, and GpsSimulator. GPS Simulator does what its name says, and requires a globe view of the earth. This is made by mapping WorldPlot onto a sphere. The sample fragment of code at the end of this message is copied from GPS Simulator, and calls up the excellent Mathview3D`OpenGLViewer of Jens-Peer Kuska. Use MVClose[] to stop Mathview3D`OpenGLViewer. This fragment is not perfect (on my machine it requires a newly-opened copy of Mathematica in order to run), but it shows the idea. Also a Mathlink dialogue box sometimes opens behind the Mathematica window instead of in front. Regards John Leary ______________________________________________________________________ << Geometry`Rotations` << Miscellaneous`WorldPlot` << "Graphics`Graphics3D`" << Graphics` SetDirectory[$HomeDirectory]; SetDirectory["path"]; Get["Mathview3D`OpenGLViewer`"] p3 = Graphics3D[Sphere[6371, 2 10, 2 20], Boxed -> True]; u = 0; shadefunc[country_] := RGBColor[0, 1, 0] f = WorldPlot[{World, shadefunc}, WorldFrame -> None, WorldGrid -> None, WorldRange -> {{-90, 90}, {-180, 180}}, WorldBackground -> RGBColor[0, 0, 1], DisplayFunction -> Identity]; gl = Show[Graphics[f], PlotRange -> {{-10007.5, 10007.5}, Automatic}, ImageSize -> 600, DisplayFunction -> Identity]; MVClear[]; MVShow3D[ Show[p3], MVTexture -> Graphics[gl], MVTextureMapType -> MVSphereMapping, MVScaleTextureTarget -> {1, 1, 1}, MVRotateTextureTarget -> {{0, 0, 1}, Pi}, MVScaleTexture -> {1, 1}] ___________________________________________________________________________