Prev: how do I change the precision of variable viewer?
Next: Problem solving 5-th order polynomial - ERROR
From: Tony Zhao on 22 Jul 2010 10:42 Hi all, I currently have an Earth model plotted using ellipsoid/surf and plastered an image file from NASA onto the model. I am trying to rotate this Earth by applying a direction cosine matrix in a for loop and updating the x, y, and z coordinates that the ellipsoid functions gives me. However, this doesn't actually make the image file of the Earth change. Does anybody know of a way to do this? Thanks!
From: Tony Zhao on 22 Jul 2010 10:51 Oh and I should mention that I am using MATLAB 6.5 and do not have the imrotate function "Tony Zhao" <crackforbrains(a)gmail.com> wrote in message <i29lbt$rda$1(a)fred.mathworks.com>... > Hi all, > > I currently have an Earth model plotted using ellipsoid/surf and plastered an image file from NASA onto the model. I am trying to rotate this Earth by applying a direction cosine matrix in a for loop and updating the x, y, and z coordinates that the ellipsoid functions gives me. However, this doesn't actually make the image file of the Earth change. Does anybody know of a way to do this? > > Thanks!
From: Walter Roberson on 22 Jul 2010 14:23 Tony Zhao wrote: > Oh and I should mention that I am using MATLAB 6.5 and do not have the > imrotate function > > "Tony Zhao" <crackforbrains(a)gmail.com> wrote in message > <i29lbt$rda$1(a)fred.mathworks.com>... >> Hi all, >> >> I currently have an Earth model plotted using ellipsoid/surf and >> plastered an image file from NASA onto the model. I am trying to >> rotate this Earth by applying a direction cosine matrix in a for loop >> and updating the x, y, and z coordinates that the ellipsoid functions >> gives me. However, this doesn't actually make the image file of the >> Earth change. Does anybody know of a way to do this? Please show a bit of your code. Your description references a "model" of Earth and an "image file" from NASA, but later you want an "image file" of the Earth to change. Is the "model" of Earth the same as the "image file" of Earth? If so then are you wanting to overwrite the file you read the "model" from? Or is the "image file" from NASA also an image file "of the Earth" and that is what you want to change? And again, if so, are you wanting to overwrite what you started with? Or when you say that the "image file" does not change, are you talking about how it displays on the screen and not about what is stored?
From: Tony Zhao on 22 Jul 2010 14:59 Hi Walter, What I have is: %Create a spherical Earth model [x,y,z] = ellipsoid(0,0,0,Earth_radius,Earth_radius,polar_radius,npanels); Earth = surf(-x,-y,-z); %Load Earth image for texture map cdata = imread(image_file); set(Earth,'facecolor','texturemap','cdata',cdata,'facealpha',alpha,'edgecolor','none'); The image_file is a .jpg file of the Earth from a NASA website. I am essentially superimposing this image on my Earth model. My problem earlier was rotating this .jpg file so that when I animate it, it looks like the Earth is essentially rotating. I know that it can also be done using hgtransform and makehgtform('zrotate',angle) (if I had a better version of MATLAB). However, I believe I have found a way to do what I wanted by using a transformation matrix and changing the x and y coordinates of my ellipsoidal Earth model at each instant in time. The only downside to this is that the animation runs really slow using my code since it has MATLAB recalculating the transformed x and y coordinates of the Earth ellipsoid model at each instant time and then displaying the Earth model by using the drawnow command in a for loop. I might be able to obtain a newer version of MATLAB, but in the meantime, is there a way to speed up the animation (or would using hgtransform help)? Thanks, Tony Walter Roberson <roberson(a)hushmail.com> wrote in message <i2a2hi$c97$1(a)canopus.cc.umanitoba.ca>... > Tony Zhao wrote: > > Oh and I should mention that I am using MATLAB 6.5 and do not have the > > imrotate function > > > > "Tony Zhao" <crackforbrains(a)gmail.com> wrote in message > > <i29lbt$rda$1(a)fred.mathworks.com>... > >> Hi all, > >> > >> I currently have an Earth model plotted using ellipsoid/surf and > >> plastered an image file from NASA onto the model. I am trying to > >> rotate this Earth by applying a direction cosine matrix in a for loop > >> and updating the x, y, and z coordinates that the ellipsoid functions > >> gives me. However, this doesn't actually make the image file of the > >> Earth change. Does anybody know of a way to do this? > > Please show a bit of your code. > > Your description references a "model" of Earth and an "image file" from NASA, > but later you want an "image file" of the Earth to change. Is the "model" of > Earth the same as the "image file" of Earth? If so then are you wanting to > overwrite the file you read the "model" from? Or is the "image file" from NASA > also an image file "of the Earth" and that is what you want to change? And > again, if so, are you wanting to overwrite what you started with? > > Or when you say that the "image file" does not change, are you talking about > how it displays on the screen and not about what is stored?
From: Walter Roberson on 22 Jul 2010 15:07 Tony Zhao wrote: > %Create a spherical Earth model > [x,y,z] = ellipsoid(0,0,0,Earth_radius,Earth_radius,polar_radius,npanels); > Earth = surf(-x,-y,-z); > > %Load Earth image for texture map > cdata = imread(image_file); > > set(Earth,'facecolor','texturemap','cdata',cdata,'facealpha',alpha,'edgecolor','none'); > > > The image_file is a .jpg file of the Earth from a NASA website. I am > essentially superimposing this image on my Earth model. My problem > earlier was rotating this .jpg file so that when I animate it, it looks > like the Earth is essentially rotating. Perhaps just change the view(), or use camorbit() ?
|
Next
|
Last
Pages: 1 2 Prev: how do I change the precision of variable viewer? Next: Problem solving 5-th order polynomial - ERROR |