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 
Switch to threaded view of this topic Create a new topic Submit Reply
Coordinates and SHADE_VOLUME [message #12105] Wed, 24 June 1998 00:00 Go to next message
Terje Fredvik is currently offline  Terje Fredvik
Messages: 5
Registered: June 1998
Junior Member
I'm using the SHADE_VOLUME procedure to create a set of
polygons that describes a surface.

Displaying the surface is trivial, I use e.g. POLYSHADE
and TVSCL, but how do I display the surface together with
a coordinate system or inside a 3D box?

--

Terje Fredvik
{ http://www.uio.no/~tfredvik/ }
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/
  Switch to threaded view of this topic Create a new topic Submit Reply
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: Sun Oct 12 01:27:31 PDT 2025

Total time taken to generate the page: 1.52020 seconds