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

Home » Public Forums » archive » Re: Setting values in an array without usings loops
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Setting values in an array without usings loops [message #35871 is a reply to message #35870] Fri, 25 July 2003 07:54 Go to previous messageGo to previous message
R.G. Stockwell is currently offline  R.G. Stockwell
Messages: 363
Registered: July 1999
Senior Member
"Johan Marais" <johan.marais@uz.kuleuven.ac.be> wrote in message
news:3f213af8_7@athenanews.com...
> I want to create a circle consisting out of ones but without the use of
for
> loops. here is how I do it with the loops. Anyone that can help?
>
> r = 33
> mask = intarr(2*r,2*r)
> for m=0,2*r-1 do begin
> for n=0,2*r-1 do begin
> if ((m-r)^2 + (n-r)^2) gt r^2 then mask[m,n] = 1
> endfor
> endfor


Weehee, if one uses a little imaginaryation:

r = 33
m = (indgen(2*r)-r) # (intarr(2*r)+1)
n = (intarr(2*r)+1) # (indgen(2*r)-r)
bobbo=long(abs(complex(m,n))/r) eq 0


I would also add the following lines:
smilesize = 3
bobbo[r/2,r-smilesize:r+smilesize] = 0
bobbo[r/2+1,r-2*smilesize:r-smilesize] = 0
bobbo[r/2+1,r+smilesize:r+2*smilesize] = 0
bobbo[r/2+2,r-3*smilesize:r-2*smilesize] = 0
bobbo[r/2+2,r+2*smilesize:r+3*smilesize] = 0
bobbo[r/2+3,r-4*smilesize:r-3*smilesize] = 0
bobbo[r/2+3,r+3*smilesize:r+4*smilesize] = 0
bobbo[3*2*r/4,2*r/4] = 0
bobbo[3*2*r/4,3*2*r/4] = 0
surface,bobbo,az=89,ax=85


bwahahahahahahahahahahahahahahahaha
Cheers,
-bob
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: How to detect edge of an image in IDL?
Next Topic: Online manual

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

Current Time: Tue Oct 21 07:06:39 PDT 2025

Total time taken to generate the page: 1.20298 seconds