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

Home » Public Forums » archive » circles
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
circles [message #9519] Wed, 09 July 1997 00:00 Go to next message
lady of the elves is currently offline  lady of the elves
Messages: 4
Registered: July 1997
Junior Member
[incidentally, I'm new to this language :)]

I'm trying to create a two-dimensional array, such that tvscl of the
array will show a filled circle. So far, my best idea has not
worked--but here it is:

x and y are one-D arrays of 200 elements such that plot,x,y produces a
circular shape, but not filled.

for round1=0,199 do begin
for round2=0,199 do begin
if (y(round1) eq y(round2)) then begin
circle(y(round1),x(round1):x(round2))=2
endif
endfor
endfor

A circle is composed of boundary points such that: for each x, there are
two y's and for each y, there are two x's--right? If I fill between the
y's, I should have a circle....right?

I would really like to have a circularly-filled array; if anyone has
better knowledge, please let me know :)
Thanks.
-gzb
Re: circles [message #9566 is a reply to message #9519] Wed, 16 July 1997 00:00 Go to previous message
pit is currently offline  pit
Messages: 92
Registered: January 1996
Member
In article <5qd140$ckk$1@gwdu19.gwdg.de>,
pit@re.uni-sw.gwdg.de (Peter Suetterlin) writes:
> In article <33C6A55C.E92FBB0D@kprwww.na.astro.it>,
> Kevin Reardon <kreardon@kprwww.na.astro.it> writes:

>> The previous suggestion by Peter Suetterlin (pit@uni-sw.gwdg.de) of:
>> img = (shift(dist(X,Y),x0,y0)) LT R
>> doesn't seem to work if x0 and y0 are not equal to X/2 and Y/2
>> (i.e. the circle is not centerted) because of wrapping problems when
>> the array is shifted.
>
> Strange, what system/version are you using?
> I checked it before posting, and just again on three different systems
> (Linux, SunOS, HP-UX) with IDL 4.01 and 3.0.0:

Yes, Kevin was right, my suggestion doesn't work in all cases, as he
wrote me by email:
The radius R of the circle has to be smaller than the shift amounts x0
and y0, and also smaller than (X-x0) and (Y-y0), or the edge-wraping of
the SHIFT function will produce strange results. Sorry :-/

Peter

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
Peter "Pit" Suetterlin http://www.uni-sw.gwdg.de/~pit
Universitaets-Sternwarte Goettingen
Tel.: +49 551 39-5048 pit@uni-sw.gwdg.de
-- * -- * ...-- * -- * ...-- * -- * ...-- * -- * ...-- * -- * ...-- * --
Come and see the stars! http://www.kis.uni-freiburg.de/~ps/SFB
Sternfreunde Breisgau e.V. Tel.: +49 7641 3492
____________________________________________________________ ______________
Re: circles [message #9585 is a reply to message #9519] Mon, 14 July 1997 00:00 Go to previous message
pit is currently offline  pit
Messages: 92
Registered: January 1996
Member
In article <33C6A55C.E92FBB0D@kprwww.na.astro.it>,
Kevin Reardon <kreardon@kprwww.na.astro.it> writes:

> ;for a circle centered at (150,50)
> xx = rebin(findgen(201,201) - 150,201,201)
^^^
must be 1

> yy = rebin(findgen(1,201) - 50,201,201)

> radial_distance = sqrt(xx^2 - yy^2)
^^^
must be a +

> tvscl,radial_distance le 50 ; displays a white filled circular mask





> The previous suggestion by Peter Suetterlin (pit@uni-sw.gwdg.de) of:
> img = (shift(dist(X,Y),x0,y0)) LT R
> doesn't seem to work if x0 and y0 are not equal to X/2 and Y/2
> (i.e. the circle is not centerted) because of wrapping problems when
> the array is shifted.

Strange, what system/version are you using?
I checked it before posting, and just again on three different systems
(Linux, SunOS, HP-UX) with IDL 4.01 and 3.0.0:
tvscl, (shift(dist(201,201),150,50)) lt 50
exactly does what it is expected to do???

Peter

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
Peter "Pit" Suetterlin http://www.uni-sw.gwdg.de/~pit
Universitaets-Sternwarte Goettingen
Tel.: +49 551 39-5048 pit@uni-sw.gwdg.de
-- * -- * ...-- * -- * ...-- * -- * ...-- * -- * ...-- * -- * ...-- * --
Come and see the stars! http://www.kis.uni-freiburg.de/~ps/SFB
Sternfreunde Breisgau e.V. Tel.: +49 7641 3492
____________________________________________________________ ______________
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: 9 Volt - The greatest electronic band ever!! - http://www.smart.net/~kkvech/index.html
Next Topic: fltarr(1,1,1,1,1,1,1,2) quirk, IDL 4

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

Current Time: Wed Oct 08 18:44:38 PDT 2025

Total time taken to generate the page: 0.00427 seconds