comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Cartesian IDLgrSurface of [theta,phi] data to a sphere??
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Cartesian IDLgrSurface of [theta,phi] data to a sphere?? [message #26184] Fri, 10 August 2001 08:24 Go to next message
david[2] is currently offline  david[2]
Messages: 100
Registered: June 2001
Senior Member
Todd Bowers writes:

> I have a 10x24 2D array of 'intensities' where the cols and rows are
> values at each theta (0 to 90, every 10 degrees, includes a polar
> 'cap') and phi (0 to 360, every 15 degrees) 'look' angle over the
> hemisphere. I can easily plot this as a shaded surface via DFanning's
> xsurface program. Problem is, it's difficult to see the directional
> relationship of the data projected on this 2D surface. So, after much
> twiddling, I tried replacing the IDLgrSurface object with an
> IDLgrPolygon. E.g,. replace this line in david's code
>
> thisSurface = OBJ_NEW('IDLgrSurface', data, x, y, $
> Color=[255,255,0], _Extra=extra)
>
> with this below to see the data shaded by value (easier to see how
> data maps to sphere in a minute)
>
> thisPalette=Obj_New('IDLgrPalette')
> thisPalette->LoadCT, 13 ;data colored blue - red
> s = Size(data, /Dimensions)
> dataColoringByValue = Reform(BytScl(data, /NaN), s[0]*s[1])
> thisSurface = OBJ_NEW('IDLgrSurface', data, x, y,
> Vert_Colors=dataColoringByValue, $
> Color=[255,255,0], Palette=thisPalette, _Extra=extra)
>
> Compile and run this. Now, think of the x axis running from the
> equator to the pole, and the y data as starting from prime meridian
> and going 360 degrees. Then, without closing this window so you can
> compare, comment out just the last line above and paste in these 2
> lines of code right after:
>
> MESH_OBJ, 4, Vertex_List, Polygon_List,Replicate(1, s[0], s[1])
> thisSurface = OBJ_NEW('IDLgrPolygon', Vertex_List,
> polygons=Polygon_List, $
> Vert_Colors=dataColoringByValue, Palette=thisPalette, style=2,
> shading=1)
>
> Move the 2 graphics windows side by side and you can see how it
> transfers to the sphere. I've tried transposing and rot'ing the heck
> outta it, as well as just trying to get it to only the hemisphere with
> NaN data to get it to plot correctly, but to no avail. 1 problem I see
> is that my (real) data is computed with a polar cap so the
> 'longitudnal' lines don't converge to a point, but the mesh_obj'd
> sphere does. Even so, my major problem is that the mapping to the
> sphere just isn't panning out. Could I please ask for
> hints/tips/suggestions???

I'm not sure I totally understand this problem, but
wouldn't it be easier (and help with the mapping)
if you put the data on the sphere as a texture map?
That way you could use the Texture_Coord keyword to
position the data anywhere you like.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Cartesian IDLgrSurface of [theta,phi] data to a sphere?? [message #26267 is a reply to message #26184] Fri, 10 August 2001 14:33 Go to previous messageGo to next message
tbowers0 is currently offline  tbowers0
Messages: 11
Registered: August 2001
Junior Member
david@dfanning.com (David Fanning) wrote in message news:<MPG.15ddaa84739ac966989e61@news.frii.com>...
>
> I'm not sure I totally understand this problem, but
> wouldn't it be easier (and help with the mapping)
> if you put the data on the sphere as a texture map?
> That way you could use the Texture_Coord keyword to
> position the data anywhere you like.
>
> Cheers,
>
> David

Thanks David. I've never done this and did think about it, but I was
hoping to be able to retain the 'awareness' of my data so that i could
possibly add code that would allow me to say, mouse over a grid point
and the value would popup. I can get teh data *on* the spherical grid
ok (see eg code from last post), I'm just not getting the idea of how
to get it to orient correctly. I've spent literally hours rotating and
transforming, but no go. I'm missing something and thought maybe
someone had some advice on it. My next option is to texture map which
is new to me so probably another can o' worms to get it mapped
correctly. Many, many thanks for your advice and time.

todd
Re: Cartesian IDLgrSurface of [theta,phi] data to a sphere?? [message #26463 is a reply to message #26267] Thu, 23 August 2001 13:23 Go to previous message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
I picked up on this one a little late but this may be of some help.

I think David's idea will be the easiest way to go. I have played around
wrapping an earth image texture onto an orb and using my camera object to
rotate the orb. The advantage of using my camera object over IDL's
trackball is that you can get the pitch, yaw and roll of the camera which
you can convert into spherical coords. The trick is to get the image mapped
correctly. Since it is a pain to map an image on the orb I let the orb
generate my texcoords and just edit my image so it maps onto the orb
correctly. This is sort of bass ackwards but it was easier than calculating
the texcoords myself.


I actually started this as a demo for my camera object but I haven't
finished it. The program linked below maps a texture onto an orb, then
allows you to rotate the orb and returns Lat and Lon, sort of.... I never
finished the conversion from IDL's angular measures to Lat/Lon (yes, it is a
simple affair but I write these programs in my spare time and we know how
that goes).


First pick up the example program and texture:

http://www.acoustics.washington.edu/rht/programs/camdemo_exa mine.zip


You will also need my camera and quaternion objects:

http://www.acoustics.washington.edu/rht/3d_animation.html


Hope this helps.

-Rick Towler



<tbowers0@yahoo.com> wrote in message
news:fd12a3f3.0108101333.39acd297@posting.google.com...
> david@dfanning.com (David Fanning) wrote in message
news:<MPG.15ddaa84739ac966989e61@news.frii.com>...
>>
>> I'm not sure I totally understand this problem, but
>> wouldn't it be easier (and help with the mapping)
>> if you put the data on the sphere as a texture map?
>> That way you could use the Texture_Coord keyword to
>> position the data anywhere you like.
>>
>> Cheers,
>>
>> David
>
> Thanks David. I've never done this and did think about it, but I was
> hoping to be able to retain the 'awareness' of my data so that i could
> possibly add code that would allow me to say, mouse over a grid point
> and the value would popup. I can get teh data *on* the spherical grid
> ok (see eg code from last post), I'm just not getting the idea of how
> to get it to orient correctly. I've spent literally hours rotating and
> transforming, but no go. I'm missing something and thought maybe
> someone had some advice on it. My next option is to texture map which
> is new to me so probably another can o' worms to get it mapped
> correctly. Many, many thanks for your advice and time.
>
> todd
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: file directory
Next Topic: Re: DLM structures passing

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:19:16 PDT 2025

Total time taken to generate the page: 0.00417 seconds