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

Home » Public Forums » archive » Re: 2D and 3D filled objects.
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
Re: 2D and 3D filled objects. [message #33371] Thu, 26 December 2002 16:00 Go to next message
David Fanning is currently offline  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
Re: 2D and 3D filled objects. [message #33468 is a reply to message #33371] Fri, 27 December 2002 08:41 Go to previous message
biomedthesis2002 is currently offline  biomedthesis2002
Messages: 12
Registered: November 2002
Junior Member
I already tried to generate the sphere the same way but the problem is
it has various densities. I want a sphere with one density and that
density is White.

I've written my own code for 3D thinning. I'm not sure if the
algorithm is right. I know what to expect when i thin a binary sphere.
That's the reason for this question. To cross check that in 2D, i need
a binary circle that is completely filled with each pixel value as
255.

Thanks.



David Fanning <david@dfanning.com> wrote in message news:<MPG.1875462552b5ecd6989a84@news.frii.com>...
> 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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Two questions about widgets
Next Topic: 2D and 3D filled objects.

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

Current Time: Sat Oct 11 05:55:52 PDT 2025

Total time taken to generate the page: 0.56051 seconds