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

Home » Public Forums » archive » Re: 3D objects & SET_MAP
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: 3D objects & SET_MAP [message #12109] Tue, 23 June 1998 00:00
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Boris V. Khattatov (boris@ucar.edu) writes:

> Does anyone know a way to display 3-D objects
> on a map projection?
>
> It's easy to display a 2-D field in lat & lon using
> TV and MAP_IMAGE, but how can I display a
> 3-D object in lat, lon, and z in map coordinates?

I offer this code totally (and I hope uncharacteristically)
without comment. :-)

Cheers,

David

-----------------------------------------------------------
PRO Example

; Create a sphere.

SPHERE = FLTARR(20, 20, 20)
FOR X=0,19 DO FOR Y=0,19 DO FOR Z=0,19 DO $
SPHERE(X, Y, Z) = SQRT((X-10)^2 + (Y-10)^2 + (Z-10)^2)
SHADE_VOLUME, SPHERE, 8, V1, P1

; Render in the Z-graphics buffer

thisDevice = !D.Name
Set_Plot, 'Z'
Device, Set_Resolution=[500,500]
Plot, Findgen(40) ; Don't remove this line! :-)
Erase

; Set !P.T Transformation matrix.

Scale3, XRANGE=[-10,30], YRANGE=[-10,30], ZRANGE=[-10,30]

; Render sphere in red colors.

LoadCT,3, NColors=100
Set_Shading, Values=[0,99]
image = POLYSHADE(V1, P1, /T3D)

; Display the map_projection.

Map_Set, /Cylindrical, /Grid, /Continents, $
/NoErase, /T3D, ZValue=10, /NoBorder, $
Position=[0,0,1,1]

PlotS, [0,1,1,0,0], [0,0,1,1,0], $
[0.5,0.5,0.5,0.5,0.5], /T3D, /Normal

; Take a snapshot of the Z-buffer.

snap = TVRD()

; Trim it up.

snap = snap(50:449, 50:449)

; Display the snapshot on the display.

Set_Plot, thisDevice
Window, XSize=400, YSize=400
TV, snap
END

-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Help with constrained fit in IDL
Next Topic: Re: Abstract Objects and Methods

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

Current Time: Sun Oct 12 04:55:46 PDT 2025

Total time taken to generate the page: 1.51727 seconds