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

Home » Public Forums » archive » disk with hole
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
disk with hole [message #56740] Wed, 14 November 2007 03:52 Go to next message
jochem.verelst@gmail. is currently offline  jochem.verelst@gmail.
Messages: 19
Registered: January 2007
Junior Member
Hi IDL gurus,

Has anybody an idea on how to create a disk with hole? So to say, it
is a circle within another circle and that surface should be filled.
Thanks to the great website of DF drawing 2 cricles is the easy part.
But filling the space in between seems to be the hard part. Anyone can
guide me further?
Thanks, greetzz,
Jochem
Re: disk with hole [message #56827 is a reply to message #56740] Wed, 14 November 2007 08:12 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Craig Markwardt writes:

> It's not that hard if you approximate a circle with a polygon.

I knew if I waited long enough, someone would come
up with that polygon solution! ;-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: disk with hole [message #56828 is a reply to message #56740] Wed, 14 November 2007 08:08 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
"jochem.verelst@gmail.com" <jochem.verelst@gmail.com> writes:

> Hi IDL gurus,
>
> Has anybody an idea on how to create a disk with hole? So to say, it
> is a circle within another circle and that surface should be filled.
> Thanks to the great website of DF drawing 2 cricles is the easy part.
> But filling the space in between seems to be the hard part. Anyone can
> guide me further?

It's not that hard if you approximate a circle with a polygon.

IDL> th = dindgen(1001)*2d*!dpi/1000d
IDL> c = cos(th) & s = sin(th)
IDL> r1 = 1d & r2 = 2d
IDL> x = [r1*c, r2*reverse(c)]
IDL> y = [r1*s, r2*reverse(s)]

IDL> plot, [-5,5], [-5,5], /nodata
IDL> polyfill, x, y

Also, I think there's nothing stopping you from making this the
USERSYM, and then overplotting it to your heart's content.

Good luck!
Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Calling f90 subroutine from IDL
Next Topic: Re: NaN Magic or Why Me?!

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

Current Time: Thu Oct 16 21:28:03 PDT 2025

Total time taken to generate the page: 1.27919 seconds