disk with hole [message #56740] |
Wed, 14 November 2007 03:52  |
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  |
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  |
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
------------------------------------------------------------ --------------
|
|
|