Re: 2D and 3D filled objects. [message #33371] |
Thu, 26 December 2002 16:00  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
New2IDL (biomedthesis2002@yahoo.com) writes:
> I'm trying to draw a circle and fill the circle with value 255. I
> want to extend this to 3D to draw a sphere and fill the sphere with
> value 255. Can anybody tell me how to obtain this.
Here is an article on how to draw a circle in IDL:
http://www.dfanning.com/tips/make_circle.html
It will lead you to TVCIRCLE from the NASA IDL Astronomy
web page, the best circle routine around, I think.
What are you planning to do with the sphere? Filling
a sphere with the value 255 is an odd sort of request.
At least I haven't run into the need for it in 15+ years
of working with IDL. :-)
I suspect there might be a simpler way of visualizing
whatever it is you are trying to visualize with
a sphere than constructing it this way. Typically,
one does an isocontour, or a polygon mesh, or
something like that.
For example, here is one way to render a sphere:
Window, XSize=300, YSize=300
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-9.5)^2 + (y-9.5)^2 + (z-9.5)^2)
Shade_Volume, sphere, 8, vertices, polygons
Scale3, XRange=[0,20], YRange=[0,20], ZRange=[0,20]
image = PolyShade(vertices, polygons, /T3D)
TV, image
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|