6

I need to incorporate a 3D model of the Earth into a satellite orbit intercept simulation I have created in Mathematica (I need it to work with "Graphics3D[]). I have downloaded several different models in formats that Mathematica claims to support and I even created my own in Pro/E. The ones that actually do get imported into the program (using "Import[]") lose their surface image and I am left with a generic sphere. How can I get custom 3D graphics to import correctly into Mathematica? Are certain formats better than others? (I have been using mostly CAD models) And is there place to download more (user-created) 3D graphics for Mathematica?

I know it's possible because Belisarius has done so in a response to a question here: How to create 2D (3D) animation in Wolfram Mathematica with the camera following the object? which is almost exactly what I need to do, as far as views go.

Community
  • 1
  • 1
Pat
  • 61
  • 2

1 Answers1

9

enter image description here

myEarth = 
 ParametricPlot3D[{Cos@u Sin@v, Sin@u Sin@v, Cos@v}, {u, 0, 2 Pi}, {v, 0, Pi}, 
   Mesh -> None, TextureCoordinateFunction -> ({#4, 1 - #5} &), 
   PlotStyle -> Texture[Show[map, ImageSize -> 1000]]];  

a = {-1, 1};
Animate[
 Show[
  Graphics3D[Sphere[{0, 0, 0}, .5], 
   ViewPoint -> 3.5 {Cos@t, Sin@t, 0}, SphericalRegion -> True, 
   PlotRange -> {a, a, a}, Axes -> False, Boxed -> False],
   myEarth], 
{t, 0, 2 Pi}]

enter image description here

Edit

I found from where I borrowed some code: http://reference.wolfram.com/mathematica/ref/Texture.html Under Applications, Earth Texture

Dr. belisarius
  • 60,527
  • 15
  • 115
  • 190
  • @Simon As I said, I've all set :). BTW the ColorData[] issue in your other question is too tricky for a complete and robust solution. I guess the default palette got buried under layer after layer of mods since version 1. Hopefully Michael or Daniel will see that one. You may ping them in a comment. – Dr. belisarius Apr 09 '11 at 06:49
  • @belisarius: Re the ColorData question: I imagine that's the case. I might ping them or ask the WRI support staff... – Simon Apr 09 '11 at 07:05
  • @belisarius Ahhhh, I have to map the image onto the sphere in after I import it. I was not aware I could do that. Thanks! Now here's the real question, is there any way to move/scale/orient it like you would do to a Graphics3D object? – Pat Apr 09 '11 at 08:25
  • @Pat You can use Rotate[],Translate[] ans Scale[] with Plots. see for example http://reference.wolfram.com/mathematica/ref/Translate.html – Dr. belisarius Apr 09 '11 at 08:52
  • @belisarius Where have you taken your nice map? Give a link please. – Alexey Popkov Apr 09 '11 at 09:24
  • 1
    Very lovely! BTW, if you are tired of spheres, see http://demonstrations.wolfram.com/ProjectionOfEarthOnPolyhedra/ but you'll have to rotate the earth by hand! – DavidC Apr 09 '11 at 09:43
  • 1
    @David Very nice demo. BTW Nobody realized that my Plot is really a time-reversal machine in disguise. – Dr. belisarius Apr 09 '11 at 09:52
  • @belisarius Yes! I hadn't noticed either. – DavidC Apr 09 '11 at 10:05
  • @belisarius Thanks for your help. Upgrading to Mathematica 8 was the key (Texture[] is a new function). I got the model to work but I probably won't be able to use it since it kills the speed of my simulation and shoots the time step way up (much like how your Earth is rotating above). It seems like the model is being dynamically created instead of just being saved as a known object. Do you know of any ways around that? I've tried exporting it then importing to no avail. – Pat Apr 10 '11 at 19:12
  • @Pat Yes, you can generate gifs as a table and export them as I did here: http://stackoverflow.com/questions/5603044/moving-an-autocad-dxf-solid-along-a-3d-path-in-mathematica/5603104#5603104 – Dr. belisarius Apr 10 '11 at 20:38