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

Home » Public Forums » archive » Newbie seeks help drawing multiple surface volumes
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
Newbie seeks help drawing multiple surface volumes [message #10381] Fri, 28 November 1997 00:00 Go to next message
Jeffrey M. Augenbaum is currently offline  Jeffrey M. Augenbaum
Messages: 3
Registered: November 1997
Junior Member
I'm new to IDL and would like to plot two surface volumes with different
colors. For example, I want to visualize some 3D aspects of fluid flow
about an object.
ie. I want to plot an ellipsoid volume in one color and then a tube with
a different color. I'd appreeciate any help with this.

Please email me directly, as I don't read this group regularly.

thanks,
Jeff
Re: Newbie seeks help drawing multiple surface volumes [message #10472 is a reply to message #10381] Mon, 01 December 1997 00:00 Go to previous message
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
Jeffrey M. Augenbaum wrote:
>
> I'm new to IDL and would like to plot two surface volumes with different
> colors. For example, I want to visualize some 3D aspects of fluid flow
> about an object.
> ie. I want to plot an ellipsoid volume in one color and then a tube with
> a different color. I'd appreeciate any help with this.
>
> Please email me directly, as I don't read this group regularly.
>
> thanks,
> Jeff

You may also want to take a look at the following URL:

http://www.sljus.lu.se/stm/IDL/Surf_Tips/

This gives examples of semi-transparent surfaces etc...

--
------------------------------------------------------------ -------
Dr. Martin Schultz
Department for Earth&Planetary Sciences, Harvard University
186 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA

phone: (617)-496-8318
fax : (617)-495-4551

e-mail: mgs@io.harvard.edu
IDL-homepage: http://www-as.harvard.edu/people/staff/mgs/idl/
------------------------------------------------------------ -------
Re: Newbie seeks help drawing multiple surface volumes [message #10473 is a reply to message #10381] Mon, 01 December 1997 00:00 Go to previous message
Jeffrey M. Augenbaum is currently offline  Jeffrey M. Augenbaum
Messages: 3
Registered: November 1997
Junior Member
Thanks for your help. It was much appreciated. In visiting various IDL
websites and looking at the IDL demo routines, I didn't see much in the way
of applications to 3D CFD visualization other than astophysics. Are other
packages better suited to CFD visualization ?

David Fanning wrote:

> Jeffrey M. Augenbaum (augenbau@erols.com) writes:
>
>> I'm new to IDL and would like to plot two surface volumes with different
>> colors. For example, I want to visualize some 3D aspects of fluid flow
>> about an object.
>> ie. I want to plot an ellipsoid volume in one color and then a tube with
>> a different color. I'd appreeciate any help with this.
>
> Why is it that people who are new to IDL always want to do
> the hardest things? How come new people don't just want to
> draw line plots? Sigh... Oh, well, at least he doesn't
> want to call this code from a C program, too. ;-)
>
> Presumably Jeffrey already knows that he is going to have
> to use Shade_Volume and PolyShade to render his 3D objects.
> (I presume he is using direct graphics or he wouldn't need
> to ask this question. Object graphics would easily allow
> him to specify his colors directly.)

How would I do this with Object graphics.

>
>
> The trick is to use the SET_SHADING command with the VALUES
> keyword to restrict his output to just a portion of the
> color table, which he has loaded with the colors he wants
> to use.
>
> Here is an example program I hacked together from some
> examples in the IDL documentation. It shows a blue tube
> (cylinder) going through a red sphere.
>
> ************************************************************ *
> PRO Example
>
> ; Load colors in different portions of the color table.
>
> LoadCT, 3, NColors=100 ; Red colors
> LoadCT, 1, NColors=100, Bottom=100 ; Blue colors
>
> ; 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
>
> ; Create a cylinder.
>
> MESH_OBJ, 3, V2, P2, Replicate(1, 48, 40), P4=40
>
> ; Render in the Z-graphics buffer
>
> thisDevice = !D.Name
> Set_Plot, 'Z'
> Device, Set_Resolution=[400,400]
> Erase
>
> ; Set !P.T Transformation matrix.
>
> Scale3, XRANGE=[0,20], YRANGE=[0,20], ZRANGE=[0,20]
>
> ; Render sphere in red colors.
>
> Set_Shading, Values=[0,99]
> image = POLYSHADE(V1, P1, /T3D)
>
> ; Render cylinder in blue colors.
>
> Set_Shading, Values=[100,199]
> T3D, Translate=[0.25,0.20,0]
> v2 = Vert_T3D(v2)
> image = POLYSHADE(V2, P2, /T3D)
>
> ; Take a snapshot of the Z-buffer.
>
> snap = TVRD()
>
> ; Display the snapshot on the display.
>
> Set_Plot, thisDevice
> Window, XSize=400, YSize=400
> TV, snap
> END
> **********************************************************
>
>> Please email me directly, as I don't read this group regularly.
>
> Only faithful readers who read the group regularly usually
> get their questions answered in this much detail. :-)

I'll try to follow this group more closely.

>
>
> Cheers,
>
> David
>
> -----------------------------------------------------------
> 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/
Re: Newbie seeks help drawing multiple surface volumes [message #10478 is a reply to message #10381] Fri, 28 November 1997 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Jeffrey M. Augenbaum (augenbau@erols.com) writes:

> I'm new to IDL and would like to plot two surface volumes with different
> colors. For example, I want to visualize some 3D aspects of fluid flow
> about an object.
> ie. I want to plot an ellipsoid volume in one color and then a tube with
> a different color. I'd appreeciate any help with this.

Why is it that people who are new to IDL always want to do
the hardest things? How come new people don't just want to
draw line plots? Sigh... Oh, well, at least he doesn't
want to call this code from a C program, too. ;-)

Presumably Jeffrey already knows that he is going to have
to use Shade_Volume and PolyShade to render his 3D objects.
(I presume he is using direct graphics or he wouldn't need
to ask this question. Object graphics would easily allow
him to specify his colors directly.)

The trick is to use the SET_SHADING command with the VALUES
keyword to restrict his output to just a portion of the
color table, which he has loaded with the colors he wants
to use.

Here is an example program I hacked together from some
examples in the IDL documentation. It shows a blue tube
(cylinder) going through a red sphere.

************************************************************ *
PRO Example

; Load colors in different portions of the color table.

LoadCT, 3, NColors=100 ; Red colors
LoadCT, 1, NColors=100, Bottom=100 ; Blue colors

; 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

; Create a cylinder.

MESH_OBJ, 3, V2, P2, Replicate(1, 48, 40), P4=40

; Render in the Z-graphics buffer

thisDevice = !D.Name
Set_Plot, 'Z'
Device, Set_Resolution=[400,400]
Erase

; Set !P.T Transformation matrix.

Scale3, XRANGE=[0,20], YRANGE=[0,20], ZRANGE=[0,20]

; Render sphere in red colors.

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

; Render cylinder in blue colors.

Set_Shading, Values=[100,199]
T3D, Translate=[0.25,0.20,0]
v2 = Vert_T3D(v2)
image = POLYSHADE(V2, P2, /T3D)

; Take a snapshot of the Z-buffer.

snap = TVRD()

; Display the snapshot on the display.

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

> Please email me directly, as I don't read this group regularly.

Only faithful readers who read the group regularly usually
get their questions answered in this much detail. :-)

Cheers,

David

-----------------------------------------------------------
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: Procedure BYTEORDER
Next Topic: axis plotting

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

Current Time: Fri Oct 10 16:30:29 PDT 2025

Total time taken to generate the page: 0.56030 seconds