next up previous contents
Next: Loops and how to Up: Appendix II: Other tips Previous: Plotting wind vectors   Contents

Plotting 3D surfaces

E.g.
pro eg_vol_2


a=1.
b=1.7
c=1.3

; Create an empty, 3D array:
ellipse = FLTARR(20, 20, 20)
; Create the spherical dataset:
FOR X=0,19 DO FOR Y=0,19 DO FOR Z=0,19 DO $
ellipse(X, Y, Z) = SQRT(((X-10)^2)/a^2. + ((Y-10)^2)/b^2. + ((Z-10)^2)/c^2.)
; Find the vertices and polygons for a density level of 8:
SHADE_VOLUME, ellipse, 8, V, P

; Set up an appropriate 3D transformation so we can see the
; sphere. This step is very important:
SCALE3, XRANGE=[0,20], YRANGE=[0,20], ZRANGE=[0,20], AX=45, AZ=-45
; Render the image. Note that the T3D keyword has been set so that 
; the previously-established 3D transformation is used:
image = POLYSHADE(V, P, /T3D)
; Display the image:TV, image
window,0,retain=2
TV, image


stop
end



John Marsham 2009-12-07