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

Home » Public Forums » archive » Coordinates and SHADE_VOLUME
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Coordinates and SHADE_VOLUME [message #12175 is a reply to message #12105] Mon, 29 June 1998 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Terje Fredvik (tfredvik@astro.uio.no) writes:

>> Simply execute the PolyShade command before you Set_Plot
>> to PostScript and scale the image with the usual XSize
>> and YSize keywords to the TV command.
>
> I'm not sure how to do that, and still keep the coordinate
> system.

Here is an example. It uses the program PSWindow, which
you can download from my web page, to set up the PostScript
window with the same aspect ratio as the display window.
This helps the PostScript output to look as much as
possible like what you see on your display. I've done
it in color so you can see how to handle some of the
issues involved with that too.

To see this on your display, just type:

IDL> Example

To create a postscript file, set the PostScript keyword:

IDL> Example, /PostScript

Cheers,

David

------------------------------------------------------------ --

PRO Example, PostScript=Postscript

; 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, vertices, polygons

; Set !P.T Transformation matrix.

Scale3, XRange=[0,20], YRange=[0,20], ZRange=[0,20]

; Render sphere in red colors.

LoadCT, 3, NColors=100
TVLCT, 255, 255, 255, 0 ; Image background white.
TVLCT, 0, 0, 255, 100 ; Blue axes color.
Device, Decomposed=0
Set_Shading, Values=[0,99]
image = PolyShade(vertices, polygons, /T3D)

; Set up PostScript file if needed.

IF Keyword_Set(postscript) THEN BEGIN
setup = PSWindow()
thisDevice = !D.Name
Set_Plot,'PS'
Device, _Extra=setup, File='example.ps', /Inches, $
Color=1, Bits_Per_Pixel=8
xsize = setup.xsize
ysize = setup.ysize
ENDIF ELSE BEGIN
xsize = 1
ysize = 1
ENDELSE

; Display image of sphere.

TV, image, XSize=xsize, YSize=ysize, /Inches

; Add axes.

Surface, Dist(20), /NoData, /T3D, CharSize=1, $
/NoErase, Color=100

; Clean up if needed.

IF Keyword_Set(postscript) THEN BEGIN
Device, /Close_File
Set_Plot, thisDevice
ENDIF

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/
[Message index]
 
Read Message
Read Message
Previous Topic: [Q]Reading XDR format in C on Macintosh?
Next Topic: Re: opening IDl files in NT

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

Current Time: Wed Dec 03 09:52:48 PST 2025

Total time taken to generate the page: 0.25199 seconds